Easy Java Code


  • 0
    E

    public class Solution {
    public int arrangeCoins(int n) {
    if(n <= 0)
    return 0;
    int index = 1;
    while(n >= index){
    n -= (index);
    index++;
    }
    return --index;
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.