1894. 找到需要补充粉笔的学生编号

1
2
3
4
5
6
7
8
class Solution:
def chalkReplacer(self, chalk: List[int], k: int) -> int:
sum_chalk = sum(chalk)
remainder = k%sum_chalk
for i in range(len(chalk)):
remainder -= chalk[i]
if remainder < 0:
return i