Tap here to switch tabs
Problem
Submissions

Problem: Maximum Height by Stacking Cuboids

med
30 min
Try to solve the Maximum Height by Stacking Cuboids problem.

Statement

You are given nn cuboids where each cuboid is represented as a list of three dimensions cuboids[i] = [width_i, length_i, height_i].

Your task is to select a subset of these cuboids and stack them to achieve the maximum total height.

You can place cuboid ii on top of cuboid jj if and only if:

  • width_i ≤\leq width_j

  • length_i ≤\leq length_j

  • height_i ≤\leq height_j

You may rotate any cuboid so that any of its three dimensions can serve as width, length, or height.

Return the maximum possible total height of the stacked cuboids.

Constraints:

  • n ==== cuboids.length

  • 1≤1 \leq n ≤100\leq 100

  • 1≤1 \leq width_i, length_i, height_i ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Height by Stacking Cuboids

med
30 min
Try to solve the Maximum Height by Stacking Cuboids problem.

Statement

You are given nn cuboids where each cuboid is represented as a list of three dimensions cuboids[i] = [width_i, length_i, height_i].

Your task is to select a subset of these cuboids and stack them to achieve the maximum total height.

You can place cuboid ii on top of cuboid jj if and only if:

  • width_i ≤\leq width_j

  • length_i ≤\leq length_j

  • height_i ≤\leq height_j

You may rotate any cuboid so that any of its three dimensions can serve as width, length, or height.

Return the maximum possible total height of the stacked cuboids.

Constraints:

  • n ==== cuboids.length

  • 1≤1 \leq n ≤100\leq 100

  • 1≤1 \leq width_i, length_i, height_i ≤100\leq 100