leetcode495
public class Solution {
public int FindPoisonedDuration(int[] timeSeries, int duration) {
if (timeSeries == null || timeSeries.Length == )
{
return ;
}
else if (timeSeries.Length == )
{
return duration;
}
else
{
var sum = ;
for (int i = ; i < timeSeries.Length - ; i++)
{
var cur = timeSeries[i];
var next = timeSeries[i + ];
if (cur + duration <= next)
{
sum += duration;
}
else
{
sum += next - cur;
}
}
sum += duration;
return sum;
}
}
}
https://leetcode.com/problems/teemo-attacking/#/description
leetcode495的更多相关文章
- [Swift]LeetCode495. 提莫攻击 | Teemo Attacking
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned ...
- 2017-3-4 leetcode 414 485 495
虽说周末要早起来着,但是日子过得有点奇怪,一不小心就忘掉了... leetcode414 https://leetcode.com/problems/third-maximum-number/?tab ...
随机推荐
- visual studio code 命令集合
title: "netcore命令行汇总" layout: post date: 2017-09-18 13:22:00" categories: netcore --- ...
- Encode Adjacent Letters
Encode a string by counting the consecutive letter. (i.e., "aaaabbxxxyyz" might become &qu ...
- 使用PE工具箱 ughost 恢复系统导致被捆绑一堆软件的问题
很多的pe系统,都有这么一个东西, 没啥技术含量,就是给ghost 加一个UI 而已 , 但是使用这玩意恢复系统,会被感染一些捆绑软件 ,开机之后就会卡顿, 并下载一堆软件 包括 爱奇艺 , 百度搜 ...
- 在crontab中执行shell脚本的问题
crontab中记录的编写比较简单,下面是一个示例: * * * /app/tpssapp/ftpsrc/tools/statTables/statTables.sh > /app/tpssap ...
- C:源文件编译过程
可以大致概括为3个阶段: 源文件 → 汇编代码(文本) 汇编代码 → 机器语言(二进制) 各个目标文件的处理 详细过程: 预编译处理 Pre-processing(*.c/ *.cpp → *.i) ...
- 【angularJS】启动(bootstrap)机制
Angular的启动分为手动和自动两种. 自动启动 定义模块的例子中,采用的就是自动的方式:通过内置的指令ngApp 来指定启动时加载的模块.<html ng-app="myApp&q ...
- LeetCode Friend Circles
原题链接在这里:https://leetcode.com/problems/friend-circles/description/ 题目: There are N students in a clas ...
- Java多线程编程核心技术,第一章
1,Java并发--详解this与Thread.currentThread()的区别:https://blog.csdn.net/championhengyi/article/details/7666 ...
- 进程间通信IPC之--无名管道(pipe)和有名管道(fifo)(转)
进程间通信IPC之--无名管道(pipe)和有名管道(fifo) 2012-01-17 22:41:20 分类: C/C++ 每个进程各自有不同的用户地址空间,任何一个进 程的全局变量在另一个进程中 ...
- 使用Maven运行Solr(翻译)
Solr是一个使用开源的搜索服务器,它采用Lucene Core的索引和搜索功能构建,它可以用于几乎所有的编程语言实现可扩展的搜索引擎. Solr的虽然有很多优点,建立开发环境是不是其中之一.此博客条 ...