Java | 1 ms
\nclass Solution {\n    public int findPoisonedDuration(int[] timeSeries, int duration) {\n        int sum=duration;\n        int d=timeSeries[0]+duration-1;\n 
```\nclass Solution {\n    public int findPoisonedDuration(int[] timeSeries, int duration) {\n        int sum=duration;\n        int d=timeSeries[0]+duration-1;\n        for(int i=1; i<timeSeries.length; i++){\n            if(timeSeries[i]<=d){\n                sum=sum+timeSeries[i]-timeSeries[i-1];\n            }\n            else{\n                sum=sum+duration;\n            }\n            d=timeSeries[i]+duration-1;\n        }\n        return sum;\n    }\n}\n```
['Java']