难度: easy
You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.
Given n, find the total number of full staircase rows that can be formed.
n is a non-negative integer and fits within the range of a 32-bit signed integer
思路: 此题有两种解法,一种是按照传统思路做,耗时很长,容易超时。还有一种是按照高斯算法,1+2+3+4+....+x<=n 即 x(x+1)/2 <=n,按照一元二次解法求出正数x
第二种方法:简单至极