Conviva Interview Question

Box stacking problem. The classic dynamic programming problem.