Easy
Quiz
#441 Arranging Coins
APPROACH
You have n coins and are building a staircase where row i requires exactly i coins. Use coins left-to-right, row by row; the last row may remain incomplete. Given n, return the count of fully completed rows.
Example 1:
Input: n = 5
Output: 2
Explanation: Because the 3rd row is incomplete, we return 2.
Example 2:
Input: n = 8
Output: 3
Explanation: Because the 4th row is incomplete, we return 3.
1 of 4
1:00
What is the optimal approach for this problem?