k to 0, which will represent the maximum number of groups we can form.total to 0, which will keep track of the sum of the first k natural numbers.total + k + 1 is less than or equal to the length of the grades array.
a. Increment k by 1.
b. Add k to total.k will be the maximum number of groups that can be formed.k.