My easy python solution


  • 0
    Y

    The idea is to find the rule of the samples.

    class Solution(object):
        def arrangeCoins(self, n):
            """
            :type n: int
            :rtype: int
            """
            i=1
            if n==1:return 1
            while(n>=i):
                n=n-i
                i+=1
            return (i-1)
    

Log in to reply
 

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