PROBLEM LINK -
Given a list of N + 1 numbers, N mixed up with them, find the maximum number between this N numbers.
Let A be the original list of size N. The number N was added in this list. Let the updated list be B. We can find the list A from the list B by finding any occurrence of the number N and deleting it. Finding maximum in a list can be done by iterating over its elements in linear time.
Parsing the input into a list of integers
For reading a line from standard input, you can use
getline(cin, s) , it will read a line and save it in string s.
You can parse the input string into integers as follows. Use string stream, read a line by
getline and put it into some stringstream, then read ints one by one until it has some. You can check if it has some using
ss >> a , it will return false if nothing is remained in stringstream (see my code for better understanding).