Simple Python AC solution


  • 0
    D
    class Solution(object):
        def findPoisonedDuration(self, timeSeries, duration):
            if not timeSeries or duration==0:
                return 0
            start = timeSeries[0]
            i=1
            res = duration
            while i < len(timeSeries):
                res+=min(duration, timeSeries[i]-start)
                start = timeSeries[i]
                i+=1
            return res
    

Log in to reply
 

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