Leetcode 495. Teemo Attacking
class Solution {
public:
int findPoisonedDuration(vector<int>& timeSeries, int duration) {
int re=duration;
for(int i=1; i<timeSeries.size(); ++i)
{
re+= timeSeries[i]-timeSeries[i-1]>= duration ? duration :timeSeries[i]-timeSeries[i-1];
}
return timeSeries.empty()?0:re;
}
};
相關文章
- [Leetcode]495.提莫攻擊LeetCode
- Attacking MongoDBMongoDB
- Attacking organizations with big scopes: from zero to hero -- by Hussein Daher
- 【LeetCode】如何學習LeetCode?LeetCode
- LeetcodeLeetCode
- LeetCode in actionLeetCode
- Leetcode AnagramsLeetCode
- Leetcode SortListLeetCode
- Leetcode ReorderListLeetCode
- leetcode SubsetsLeetCode
- Leetcode PermutationsLeetCode
- [LeetCode刷題筆記] 關於LeetCode的前言LeetCode筆記
- 我的 LeetCodeLeetCode
- Leetcode學習LeetCode
- LeetCode 53 JSLeetCodeJS
- LeetCode 50 JSLeetCodeJS
- LeetCode 克隆圖LeetCode
- Leetcode Perfect SquaresLeetCode
- Leetcode Sort ColorsLeetCode
- Leetcode Sort ArrayLeetCode
- 【LeetCode】Jewels and StonesLeetCode
- 嘗試 LeetcodeLeetCode
- LeetCode 消除遊戲LeetCode遊戲
- Leetcode03LeetCode
- Leetcode LRU CacheLeetCode
- Leetcode Path SumLeetCode
- LeetCode Min StackLeetCode
- Leetcode Word SearchLeetCode
- Leetcode Number of islandsLeetCode
- Leetcode-394LeetCode
- Leetcode 921 JavascriptLeetCodeJavaScript
- golang刷leetcodeGolangLeetCode
- LeetCode:快速排序LeetCode排序
- [LeetCode] Group AnagramLeetCode
- leetcode690LeetCode
- LeetCode 283 jsLeetCodeJS
- Leetcode #463 JavascriptLeetCodeJavaScript
- Leetcode # 495 JavascriptLeetCodeJavaScript