My Java Solution


  • 0
    R
    public class Solution {
        public int arrangeCoins(int n) {
            int row = 1, count = 0;
            for(int i = 1; i <= n; i ++){
                n -= i;
                row++;
                if(n < row){
                    return i;
                }
                else{
                    count++;
                }
            }
            return count;
        }
    }

Log in to reply
 

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