```
import math
class Solution:
def arrangeCoins(self, n):
"""
:type n: int
:rtype: int
"""
return int((math.sqrt(1 + 8*n) - 1)/2)
```

If there are x rows formed properly, we will have following equation getting satisfied

x(x+1) / 2 < n

Solving the quadratic equation, x^2 + x - 2n < 0, we get,

x = { -1 + sqrt(1 + 8n) } / 2.