Arranging Coins
Easy
Topics
You have n coins and want to build a staircase where row i holds exactly i coins. The last row may be incomplete. Return the number of complete rows you can build.
Example 1
Input: n = 5 Output: 2
Example 2
Input: n = 8 Output: 3
Example 3
Input: n = 1 Output: 1
Constraints
- 1 <= n <= 2^31 - 1
Run ⌘' · Submit ⌘⏎