1894. Find the Student that Will Replace the Chalk
On This Page
class Solution:
def chalkReplacer(self, chalk: List[int], k: int) -> int:
s = sum(chalk)
k %= s
for i, x in enumerate(chalk):
if k < x:
return i
k -= x