Created
December 12, 2014 15:17
-
-
Save ik11235/e3525c46e948678a3a7f to your computer and use it in GitHub Desktop.
This file contains 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 BuyingTshirts { | |
public: | |
int meet(int T, vector<int> Q, vector<int> P) { | |
int ans=0; | |
int qq=0; | |
int pp=0; | |
for(int i=0;i<Q.size();i++) | |
{ | |
qq+=Q[i]; | |
pp+=P[i]; | |
if(pp>=T && qq>=T) | |
ans++; | |
if(pp>=T) | |
pp-=T; | |
if(qq>=T) | |
qq-=T; | |
} | |
return ans; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment