Easy approach.
ApproachAssuming that there is no duplication between each consecutive element in the array, then we run for loop to check that duplication, if there is a dupli
# Approach\nAssuming that there is no duplication between each consecutive element in the array, then we run for loop to check that duplication, if there is a duplication, then we caculate the duration of that and remove that from "cnt". \n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n        int lv=timeSeries.size();\n        long long cnt=1ll*duration*lv;//     assume that there is no duplication\n        for(int i=0;i<lv-1;++i)\n            if(timeSeries[i+1]-timeSeries[i]<duration) cnt-=duration-(timeSeries[i+1]-timeSeries[i]);//     remove the duplication\n        return (int)cnt;\n    }\n};\n```
['C++']