Created
March 31, 2012 15:35
-
-
Save yasith/2266248 to your computer and use it in GitHub Desktop.
TCO'11 Qual 1
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
| int MinimumLiars::getMinimum(vector <int> claim) { | |
| for (int i=0;i<claim.size();i++){ | |
| int count=0; | |
| for (int j=0;j<claim.size();j++) | |
| if(claim[j]>i+1) | |
| count++; | |
| if (count==i+1) | |
| return i+1; | |
| } | |
| for (int i=0;i<claim.size();i++){ | |
| if (claim[i]!=0) | |
| break; | |
| if (i==claim.size()-1) | |
| return 0; | |
| } | |
| return -1; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code by https://github.com/sachith500