Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Groups Entering a Competition

med
30 min
Try to solve the Maximum Number of Groups Entering a Competition problem.

Statement

You are given a positive integer array grades representing the scores of students participating in a competition.

You want to organize these students into kk consecutive groups such that for every group index ii where 1≤i<k1 \leq i < k:

  1. The total sum of grades of students in the (i+1)(i + 1)-th group is strictly greater than the total sum of grades of students in the ii-th group.

  2. The total number of students in the (i+1)(i + 1)-th group is strictly greater than the total number of students in the ii-th group.

Return the maximum number of groups kk that can be formed.

Constraints:

  • 1≤1 \leq grades.length ≤105\leq 10^5

  • 1≤1 \leq grades[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Number of Groups Entering a Competition

med
30 min
Try to solve the Maximum Number of Groups Entering a Competition problem.

Statement

You are given a positive integer array grades representing the scores of students participating in a competition.

You want to organize these students into kk consecutive groups such that for every group index ii where 1≤i<k1 \leq i < k:

  1. The total sum of grades of students in the (i+1)(i + 1)-th group is strictly greater than the total sum of grades of students in the ii-th group.

  2. The total number of students in the (i+1)(i + 1)-th group is strictly greater than the total number of students in the ii-th group.

Return the maximum number of groups kk that can be formed.

Constraints:

  • 1≤1 \leq grades.length ≤105\leq 10^5

  • 1≤1 \leq grades[i] ≤105\leq 10^5