I think first we need to sort the boxes in decreasing order of volume so that input like this (7,8,9),(5,6,8),(5,8,7),(4,4,4),(3,2,1), (9,9,10),(9,3,7) becomes (9,9,10),(7,8,9),(5,8,7),(5,6,8),(9,3,7), (4,4,4),(3,2,1) . Now we can apply DP here . Let dp[i] = maximum no. of boxes fitting into each other such that the i_th box is the last to fit. Then dp[i] = max(dp[j]) +1 , where j<i and wi>wj , hi>hj and li>lj . .
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.