dp with the same length as the number of cuboids, filled with zeros.j:
a. Set dp[j] to the height of the current cuboid.
b. Iterate through all previous cuboids with index i:
i. If cuboid i can be placed under cuboid j (all dimensions of i are less than or equal to j), update dp[j] to the maximum of dp[j] and dp[i] + height of cuboid j.dp array.