提交结果 | 执行用时 | 内存消耗 | 语言 | 提交时间 | 备注 |
---|---|---|---|---|---|
通过 | 56 ms | 15.8 MB | Python3 | 2021/11/10 09:28 |
class Solution:
def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:
ans, expired = 0, 0
for i in range(len(timeSeries)):
if timeSeries[i] >= expired:
ans += duration
else:
ans += timeSeries[i] + duration - expired
expired = timeSeries[i] + duration
return ans