Monday, March 9, 2009

Tower of cubes

You have a set of solid 3-d cubes. Each cube has 6 faces, with different colors on each face. Cubes have different weights. One cube can be put on the top of the other if and only if (a) the two touching faces have the same color, and (b) the lighter cube is above the heavier one.

Find the height of longest tower that you can build, in optimal space and time.

No comments:

Post a Comment