Simple Python with Math

  • 0

    class Solution(object):
    def findPoisonedDuration(self, timeSeries, duration):
    :type timeSeries: List[int]
    :type duration: int
    :rtype: int
    total = 0
    timeSeries = [i+duration-1 for i in timeSeries]
    last = 0
    for i in timeSeries :
    if (i-duration+1)<=last and last != 0:
    total += i-last
    total += duration
    last = i
    return total

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.