Simple solution but slowly


  • 0
    T
    public class Solution {
        public int arrangeCoins(int n) {
            int lvl =0;
            while(n-lvl>0){
                lvl++;
                n=n-lvl;
            }
            return lvl;
        }
    }
    

Log in to reply
 

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