c++ | easy | short
\n# Code\n\nclass Solution {\npublic:\n   int findPoisonedDuration(vector<int>& tS, int duration) {\n    int out = 0;\n    for(int i=0;i<tS.size()-1;i++) {\n   
\n# Code\n```\nclass Solution {\npublic:\n   int findPoisonedDuration(vector<int>& tS, int duration) {\n    int out = 0;\n    for(int i=0;i<tS.size()-1;i++) {\n        if(tS[i] + duration > tS[i+1])\n            out += tS[i+1] - tS[i];\n        else\n            out += duration;\n    }\n    return out + duration;\n}\n};\n```
['C++']