C++ solution | 94.92% time, 67.30% space | basic arithmetic
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int findPoisonedDuration(vector<int>& timeSeries, int duration);\n};\n/***************************************************************/\nint Solution::findPoisonedDuration(vector<int>& timeSeries, int duration) {\n    int count=0, i, size = timeSeries.size();\n    for (i = 0; i < size-1; ++i) {\n        count+= (timeSeries[i+1] - timeSeries[i] >= duration) ? duration : timeSeries[i+1]-timeSeries[i];\n    }\n    count+=duration;\n    return count;\n}\n/***************************************************************/\n\n```
['C++']