Question bank › Recursion
Dsa Recursion Medium

Arrange Coins in a Staircase

You have a certain number of coins, and you want to arrange them in a staircase shape. In the first row, you can place 1 coin, in the second row 2 coins, in the third row 3 coins, and so on. Write a function to find out how many complete staircase rows you can build with the given number of coins. Input format: - A single integer c (1 <= c <= 1000), the total number of coins. Output format: - Print the maximum number of complete staircase rows you can build. Example: Input: 5 Output: 2 (The arrangement is 1+2 = 3, and the third row cannot be built since you need 3 coins for it.)

Key concepts

recursionmathematical reasoningcounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.