javascript Arranging Coins code example
Example: javascript Arranging Coins
// leetcode arranging coins
var arrangeCoins = function(n) {
let i = 1, j = 0
while(n>0){
n -= i
j++
i++
}
if(n === 0) return j
else return --j
};