You have a stack of n boxes, with widths wi, heights hi, and depths di. The boxes cannot be rotated and can only be stacked on top of one another if each box in the stack is strictly larger than the box above it in width, height, and depth. Implement a method to compute the height of the tallest possible stack. The height of a stack is the sum of the heights of each box.
The input use [wi, di, hi]
to represents each box.
Example1:
Input: box = [[1, 1, 1], [2, 2, 2], [3, 3, 3]]
Output: 6
Example2:
Input: box = [[1, 1, 1], [2, 3, 4], [2, 6, 7], [3, 4, 5]]
Output: 10
Note:
box.length <= 3000