I am working on a python programming problem and not able to think how to get around it. Could someone help me?
I have an input of non-empty array of disks :
[[2, 1, 2],[2, 2, 8],[1, 3, 1], [2, 3, 4], [4, 4, 5], [3, 2, 3]]
where the 1st element, 2nd, and 3rd element inside the subarrays are width, depth and height respectively of the disks.
Aim is to stack up the disks and to maximize the total height of the stack with the condition “A disk must have a strictly smaller width, depth, and height than any other disk below it”.
I need to write a function that returns an array of the disks in the final stack, starting with the top disk and ending with the bottom disk.
For the above input, the function should return:
[[4, 4, 5], [3, 2, 3], [2, 1, 2]].