scores[i] is the rating of player i. Split all players into non-empty teams and line the teams up so that each team is strictly larger than the one before it both in headcount and in the total rating. Every player belongs to exactly one team.
Return the largest possible number of teams.scores=[4, 9, 2, 7, 5, 1, 8] → 3
For instance: team [1] with sum 1, team [2, 4] with sum 6 and team [5, 7, 8, 9] with sum 29. Four teams would need at least 1 + 2 + 3 + 4 = 10 people, but there are only 7.
scores=[6, 6] → 1
Two one-person teams are not allowed, since sizes must strictly grow, so both people form a single team.
scores=[3] → 1
len(scores) ≤ 10⁵scores[i] ≤ 10⁵scores=[4, 9, 2, 7, 5, 1, 8]
3
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.