Practice Arranging Coins
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return the number of complete rows of the staircase you will build.
Source: Arranging Coins on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 5
Output
2
# Example 2
Input
n = 8
Output
3
Constraints
1 <= n <= 2^31 - 1
Related LeetCode Problems
Practice more problems similar to Arranging Coins.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.