Ruby-one time pass


  • 0
    S
    def find_poisoned_duration(time_series, duration)
        ded=0
        for i in 1...time_series.length
            if time_series[i]-time_series[i-1]<duration
                ded+=(duration-(time_series[i]-time_series[i-1]))
            end
        end
        return time_series.length*duration-ded
    end
    

Log in to reply
 

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