why Wrong Answer?


  • 0
    Z
        public int findPoisonedDuration(int[] timeSeries, int duration) {
            if (timeSeries.length == 0) return 0;
            int last = timeSeries[0], time = 0, j = 0;
            for(int i=0;i<=timeSeries[timeSeries.length-1]+duration;i++){
                if((i>last) && (i<=last+duration))time ++;
                if(i == timeSeries[j]){
                    last = timeSeries[j];
                    if(j<timeSeries.length-1)j ++;
                }
            }
            return time;
        }
    }```

  • 0
    Z

    ignore the last line code


Log in to reply
 

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