First Repeated Value
Scanning left to right, print the first value that has already appeared earlier. If all values are distinct, print NONE.
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: the first repeated value, or NONE.
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
5 2 5 3 5 2
Output 1
5
Input 2
3 1 2 3
Output 2
NONE
Discussion (opens after you solve — no spoilers before)
No comments yet.