1385. Number of Ways to Build House of Cards

Medium
Math
Dynamic Programming

Description

Hints

Hint 1
If a row has k triangles, how many cards does it take to build that row? It takes 3 * k - 1 cards.
Hint 2
If you still have i cards left, and on the previous row there were k triangles, what are the possible ways to build the current row? You can start at 1 triangle and continue adding more until you run out of cards or reach k - 1 triangles.

Similar Questions

Statistics

Acceptance
62.8%
Submissions
5,978
Accepted
3,752