I found this famous dp problem in many places, but I can not figure out how to solve.
You are given a set of n types of rectangular 3-D boxes, where
I suggest you create a tree (or some sort of tree structure) and parse it with depth search, calculating the max height from the individual vertical "height" (depening on rotation) values.
This (I think this is the basic approach).
Details over details:
The Tree root should be the floor, where any cube fits onto. From there you just create the child nodes of possible next (boxes that can be placed in a certain rotation ontop of the current box) boxes. Recursivly do that for each box and rotation.
When the tree is build, go through it and calc the total tower heigth from floor to a leaf of the tree.