Answers for "Arranging Coins"

0

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"

Browse Popular Code Answers by Language