<p>Well, the box has to be rectangular. You can pack the three cubes into a container of 36 square inches, but it would have an odd shape. Imagine you have a 3-inch cube and want to add a 2-inch cube to it; if you place them side by side, then their combined base is 5 inches and their combined height (and width) is 3 inches. Then, you can add the 1-by-1 cube above the 2-by-2 cube. Consequently, the optimal rectangular prism that can envelop those 3 cubes is 5-by-3-by-3, or 45 cubic inches in volume.</p>