We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df54373 commit d7f2304Copy full SHA for d7f2304
leetcode/0495.Teemo-Attacking/495.Teemo Attacking.go
@@ -0,0 +1,16 @@
1
+package leetcode
2
+
3
+func findPoisonedDuration(timeSeries []int, duration int) int {
4
+ var ans int
5
+ for i := 1; i < len(timeSeries); i++ {
6
+ t := timeSeries[i-1]
7
+ end := t + duration - 1
8
+ if end < timeSeries[i] {
9
+ ans += duration
10
+ } else {
11
+ ans += timeSeries[i] - t
12
+ }
13
14
15
+ return ans
16
+}
0 commit comments