3
// T(n) = O(n) S(n) = O(1)4
int chalkReplacer(vector<int> &chalk, int k) {7
// Store the sum of the elements in the vector9
// Calculate the sum of the elements10
for (int n : chalk) sum += n;11
// Update k as the remainder of the sum12
// to make sure that the while loop13
// will traverse the vector at most 1 time15
// Start from the initial value in the array17
// While the next student has enough chalk18
while (k >= chalk[idx]) {19
// Decrease the remaining chalk24
// Return the index of the student without