You have a total ofncoins that you want to form in a staircase shape, where everyk-th row must have exactlykcoins.

Givenn, find the total number of**full**staircase rows that can be formed.

nis a non-negative integer and fits within the range of a 32-bit signed integer.

**Example 1:**

n = 5The coins can form the following rows:¤¤ ¤¤ ¤Because the 3rd row is incomplete, we return 2.

**Example 2:**

n = 8The coins can form the following rows:¤¤ ¤¤ ¤ ¤¤ ¤Because the 4th row is incomplete, we return 3.

https://leetcode.com/problems/arranging-coins/description/

根据求和公式推导即可

class Solution {public int arrangeCoins(int n) {return (int) (Math.sqrt(2L * n + 1.0 / 4) - 1.0 / 2);}}