---
# System prepended metadata

title: 1894. Find the Student that Will Replace the Chalk
tags: [Leetcode, Simulation, Medium]

---

# 1894. Find the Student that Will Replace the Chalk
###### tags: `Leetcode` `Medium` `Simulation`
Link: https://leetcode.com/problems/find-the-student-that-will-replace-the-chalk/description/
## 思路
先求出chalk list的sum 然后k%sum就是最后一轮一共剩了多少chalk
接着遍历chalk array找到要replace chalk的人
## Code
```python=
class Solution:
    def chalkReplacer(self, chalk: List[int], k: int) -> int:
        once = sum(chalk)
        remain = k%once
        cur = 0
        while remain>=chalk[cur]:
            remain -= chalk[cur]
            cur+=1
        return cur
```