提莫攻击 Posted on 2021-11-10 Edited on 2022-04-14 In LeetCode Views: Waline: Views: Symbols count in article: 201 Reading time ≈ 1 mins. 题解方法 模拟 模拟 模拟中毒时间区间的合并 若下一个区间的左边界大于上一个区间的右边界,则统计上一个区间的范围 核心代码模拟1234567for (int time: timeSeries) { if (time > r) { cnt += (r - l); l = time; } r = time + duration;} 题目来源495. 提莫攻击 - 力扣(LeetCode) (leetcode-cn.com)