python solution


  • 0
    B
    class Solution(object):
        def findPoisonedDuration(self, timeSeries, duration):
            """
            :type timeSeries: List[int]
            :type duration: int
            :rtype: int
            """
            res = len(timeSeries)*duration
            for i in range(1,len(timeSeries)):
                time=duration-timeSeries[i] + timeSeries[i-1]
                if time>=0:
                    res-=time
            return res
    

Log in to reply
 

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