leetcode 495 Teemo Attacking C++
来源:互联网 发布:福建网络干部学院app 编辑:程序博客网 时间:2024/06/10 09:03
这题就是两次攻击间隔小于duration的话就加间隔,否则加duration。
注意最后一次和没有的情况即可。
int findPoisonedDuration(vector<int>& timeSeries, int duration) { if (timeSeries.empty()) return 0; int sum = 0; for (int i = 0;i<timeSeries.size() - 1;i++) { if (timeSeries[i+1] - timeSeries[i] > duration) { sum += duration; } else { sum += (timeSeries[i+1] - timeSeries[i]); } } return sum + duration; }
0 0
- LeetCode 495 --- Teemo Attacking
- Leetcode 495 Teemo Attacking
- LeetCode 495 Teemo Attacking
- [Leetcode 495] Teemo Attacking
- LeetCode.495 Teemo Attacking
- leetcode 495 Teemo Attacking C++
- leetcode 495[medium]----Teemo Attacking
- LeetCode题解:Teemo Attacking
- LeetCode 495. Teemo Attacking
- LeetCode: Teemo Attacking
- LeetCode 495. Teemo Attacking
- LeetCode:495. Teemo Attacking
- 【Leetcode】495. Teemo Attacking
- [leetcode] 495. Teemo Attacking
- LeetCode|Array|Teemo Attacking
- leetcode 495. Teemo Attacking
- 【LeetCode】495. Teemo Attacking
- LeetCode 495. Teemo Attacking
- 网络抓包工具Fiddler的使用
- 十条笑话:结账时要320元,于是我和老板讲价,说给300行不
- materiallDesign资料收集
- TensorFlow文本摘要生成
- 1004. 成绩排名 (20)
- leetcode 495 Teemo Attacking C++
- POJ 2243Knight Moves (bfs)
- Java NIO使用及原理分析 (一)
- 详解c++指针的指针和指针的引用
- 如何实现浏览器内多个标签页之间的通信
- 数据结构整理(二)Collection集合接口
- wpf 制作带小箭头的框框
- 金字塔数字排列方法
- Delete Node in a BST