From 8ba93f3bb6303c8a2f757f644b85d88b71dc0cad Mon Sep 17 00:00:00 2001 From: Akshay Agarwal Date: Fri, 2 Oct 2020 16:38:29 +0530 Subject: [PATCH] Create teemoAttacking https://leetcode.com/problems/teemo-attacking/ --- teemoAttacking | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 teemoAttacking diff --git a/teemoAttacking b/teemoAttacking new file mode 100644 index 0000000..9621275 --- /dev/null +++ b/teemoAttacking @@ -0,0 +1,19 @@ +func findPoisonedDuration(timeSeries []int, duration int) int { + c,e:=0,0 + for i,v := range timeSeries{ + if i==0{ + c+=duration + e = v+duration-1 + continue + } + if v<=e{ + ne := v+duration-1 + c+=(ne-e) + e = ne + }else{ + c+=duration + e = v+duration-1 + } + } + return c +}