1742. Maximum Number of Balls in a Box
On This Page
class Solution:
def countBalls(self, lowLimit: int, highLimit: int) -> int:
cnt = [0] * 50
for x in range(lowLimit, highLimit + 1):
y = 0
while x:
y += x % 10
x //= 10
cnt[y] += 1
return max(cnt)