Uber Interview Question

stack + 3D dp question based on the stable cuboid alignment