simple python solution


  • 0
    class Solution(object):
        def arrangeCoins(self, n):
            """
            :type n: int
            :rtype: int
            """
            k = 1
            
            while n >= 0:
                n -= k
                k += 1
                
            return k - 2
    

Log in to reply
 

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