Link to problem: https://www.codechef.com/problems/LOSTMAX

This is my logic for the problem. Is this solution correct? I am really getting frustrated with competitive programming as I cannot think of the algorithm for some of the problems on the easy section. Please someone help me in anyway they can. I really need to get a job and make money for myself. Thank you.

```
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int tc = 0;
std::cin >> tc;
while(tc--) {
//Read in N
int N = 0;
std::cin >> N;
//Declar vector inputs and vector
int input = 0;
std::vector<int> intVec(N + 1);
//Read in values for vector
for (int i = 0; i < N + 1; ++i) {
std::cin >> input;
intVec.push_back(input);
}
//Remove N from the vector
intVec.erase(std::remove(intVec.begin(), intVec.end(), N), intVec.end());
//Find the max of the remaining elements and print out the max number
std::cout << *std::max_element(intVec.begin(), intVec.end()) << std::endl;
}
return 0;
}
```