Answers for "javascript Arranging Coins"

0

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
};
Posted by: Guest on July-02-2020

Code answers related to "javascript Arranging Coins"

Code answers related to "Javascript"

Browse Popular Code Answers by Language