2790. Maximum Number of Groups With Increasing Length
You are given a 0-indexed array
usageLimits
of lengthn
.Your task is to create groups using numbers from
0
ton - 1
, ensuring that each number,i
, is used no more thanusageLimits[i]
times in total across all groups. You must also satisfy the following conditions:
- Each group must consist of distinct numbers, meaning that no duplicate numbers are allowed within a single group.
- Each group (except the first one) must have a length strictly greater than the previous group.
Return an integer denoting the maximum number of groups you can create while satisfying these conditions.
1 | class Solution { |