Short c++


  • 0
      int findPoisonedDuration(vector<int>& timeSeries, int duration) {
            int tot=0, end=0;
            for(int t:timeSeries) {
                tot += min(duration,t+duration-end);
                end = t+duration;
            }
            return tot;
        }
    

Log in to reply
 

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