Practice Maximum Height by Stacking Cuboids
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given n cuboids where the dimensions of the ith cuboid is cuboids[i] = [widthi, lengthi, heighti] (0-indexed). Choose a subset of cuboids and place them on each other. You can place cuboid i on cuboid j if widthi <= widthj and lengthi <= lengthj and heighti <= heightj. You can rearrange any cuboid's dimensions by rotating it to put it on another cuboid. Return the maximum height of the stacked cuboids.
Source: Maximum Height by Stacking Cuboids on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
cuboids = [[50,45,20],[95,37,53],[45,23,12]]
190
# Example 2
cuboids = [[38,25,45],[76,35,3]]
76
# Example 3
cuboids = [[7,11,17],[7,17,11],[11,7,17],[11,17,7],[17,7,11],[17,11,7]]
102
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Height by Stacking Cuboids .
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.