The idea is about quadratic equation, the formula to get the sum of arithmetic progression is

sum = (x + 1) * x / 2

so for this problem, if we know the the sum, then we can know the x = (-1 + sqrt(8 * n + 1)) / 2

```
public class Solution {
public int arrangeCoins(int n) {
return (int)((-1 + Math.sqrt(1 + 8 * (long)n)) / 2);
}
}
```