| 2 | using namespace std; |
| 3 | |
| 4 | int solve(vector<int>& a) { |
| 5 | int i=1; |
| 6 | //Copy array into unordered_set |
| 7 | unordered_set<int> us(a.begin(), a.end()); |
| 8 | while(i <= us.size()){ |
| 9 | //Increment i by 1 and search in set. Searching is O(1) |
| 10 | if (us.find(i) == us.end()) |
| 11 | break; |
| 12 | ++i; |
| 13 | } |
| 14 | //if i is not found return i. |
| 15 | return i; |
| 16 | } |
| 17 | int main() { |
| 18 | int t; |
| 19 | cin>>t; |