JavaScript Only 1 line O(n) Solution


  • 0
    Y
    const findPoisonedDuration = (timeSeries, duration) => timeSeries.reduce((s, v, i, a) => s + Math.min(v - (a[i-1] || -Infinity), duration), 0);
    

Log in to reply
 

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