[ faster than 98.41%][easy understanding][c++]
\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int n=timeSeries.size();\n\t\t\n        if(n==0) ret
```\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int n=timeSeries.size();\n\t\t\n        if(n==0) return 0;\n\t\t\n        int sum=0;\n        for(int i=0;i<n-1;i++){\n            if(timeSeries[i]+duration<=timeSeries[i+1]) sum+=duration;\n            else sum+=(timeSeries[i+1]-timeSeries[i]);\n        }\n\t\t\n        return sum+duration;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']