LeetCode 1894. Find the Student that Will Replace the Chalk Posted on 2021-06-13 Edited on 2024-11-24 In LeetCode 12345678910class Solution {public: int chalkReplacer(vector<int>& chalk, int k) { long long s = 0; for (int c : chalk) s += c; int t = k % s, i = 0; while (t >= chalk[i]) t -= chalk[i++]; return i; }};