HomeMaximum Number of Groups With Increasing Length 1 2 3 4 5 6 7 8 9 10 class Solution: def maxIncreasingGroups(self, usageLimits: List[int]) -> int: usageLimits.sort() total = 0 k = 0 for n in usageLimits: total += n if total >= (k + 1) * (k + 2) // 2: k += 1 return k
1 2 3 4 5 6 7 8 9 10
class Solution: def maxIncreasingGroups(self, usageLimits: List[int]) -> int: usageLimits.sort() total = 0 k = 0 for n in usageLimits: total += n if total >= (k + 1) * (k + 2) // 2: k += 1 return k