An easy java solution


  • 0
    I
    public class Solution {
        public int arrangeCoins(int n) {
            int count = 0;
            while (n >= (count + 1)) {
            	count++;
            	n -= count;
            }
            return count;
        }
    }

Log in to reply
 

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