Last active
September 21, 2017 09:24
-
-
Save freelze/cc3ac456c08ff25f246e6fa3894fddee to your computer and use it in GitHub Desktop.
Runtime: 59 ms , Your runtime beats 76.14 % of cpp submissions.(2017/9/21)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
int findPoisonedDuration(vector<int>& ts, int dur) { | |
unsigned int temp=0; | |
for(int i=0;i < (int)ts.size()-1 ; i++){ | |
if( (int)dur-ts[i+1]+ts[i] > 0) | |
temp+=(int)dur-ts[i+1]+ts[i]; | |
} | |
return (int)dur*ts.size()-temp; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment