I encountered this question in an interview and could not figure it out. I believe it has a dynamic programming solution but it eludes me.
Given a number of bricks, output the total number of 2d pyramids possible, where a pyramid is defined as any structure where a row of bricks has strictly less bricks than the row below it. You do not have to use all the bricks.
It makes sense to just add P(1) + ... + P(n), but how to find all possible pyramids with 1 < i <= n bricks?
Code length is not as important as the solution itself, but go ahead and have fun with it?