Problem Description
If there are multiple possible answers ( like in the sample case ), output any one, if there is no duplicate, output -1
A = [3, 4, 1, 4, 2]Input 2:
A = [1, 2, 3]Input 3:
A = [3, 4, 1, 4, 1]
4Output 2:
-1Output 3:
1
4 repeats itself in the array [3, 4, 1, 4, 2]Explanation 2:
No number repeats itself in the array [1, 2, 3]Explanation 3:
1 and 4 repeats itself in the array [3, 4, 1, 4, 1], we can return 1 or 4
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.