Arranging Coins
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You have n coins and want to build a staircase: row 1 gets 1 coin, row 2 gets 2 coins, row k gets k coins. The last row you start may end up incomplete.
Return the number of **complete** rows you can build — the largest k with 1 + 2 + ... + k <= n.
Aim for O(log n) time via binary search (or O(1) with care for integer precision).
Examples
Constraints
- 1 <= n <= 2^31 - 1
- Rows are filled in order; row `k` needs exactly `k` coins.
- Return a non-negative integer.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.