arranging coins leetcode problem code example
Example: 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
};
var arrangeCoins = function(n) {
let i = 1, j = 0
while(n > 0){
n -= i
j++
i++
}
if(n === 0) return j
else return --j
};