You are viewing a single comment's thread. Return to all comments →
I believe this is O(n^2). O(n) is also possible.
The OP is O(n)
its o(n^2), coz in worst case senario, all the choclate blocks would add up to d.
I have implemented it in O(n).
can you show your logic ???