Solve the Pyramid problem from Assignment 2