Skip to main content

441. Arranging Coins

https://leetcode.com/problems/arranging-coins

Python

class Solution:
def arrangeCoins(self, n: int) -> int:
row_counts = 0
counter = 1

while n > 0:
if n - counter >= 0:
row_counts += 1

n -= counter
counter += 1

return row_counts