C++ || Keep track of the end time
Please upvote of you like the solution !!!\n\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int sum 
Please upvote of you like the solution !!!\n```\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int sum = 0, end = -1;\n        \n        for(int i = 0; i <timeSeries.size(); i++){\n            //if the time interval collides\n            //exclude the common interval \n            //as it is already included in the answer\n            if(end >= timeSeries[i])\n                sum += duration - (end - timeSeries[i]+1);\n            else\n            sum += duration; //if no collision,simply add the whole duration\n            end = timeSeries[i] + duration - 1; //keep updating end time\n        }\n        \n        return sum;\n    }\n};\n```
['C']