Interview Question
@eepiyush: Why spam CC with OLD posts only.
Go to stackoverflow, and post there, your moron!
This problem I saw in GOOGLE section. I found "lol" presented a complete solution to this. Why the fucking asshole you need to repost... if you can't get the solution, why don't ask it there!
This is a dynamic programming question. First sort the boxes in descending order of area in O(n log n). Then for each box i, the maximum stack height is:
- Ashish Kaila September 04, 2011H(i) = Max (H(i-1), H(j) + h(i)) where L(i) < L(j) and W(i) < W(j)
FInally just pick the max height looking back from the array values.