Find the Unique Element
Easyjavapythonccppjavascript
Every element in an array appears exactly twice except one element, which appears once. Find the element that appears only once.
Input Format
The first line contains an integer N (N is odd). The second line contains N space-separated integers.
Output Format
Print the element that appears exactly once.
Example 1
Input
5 4 1 2 1 2
Output
4
Explanation: 1 and 2 appear twice; 4 appears once.
- 1 <= N <= 100000
- N is odd
- -1000000000 <= A[i] <= 1000000000
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Find the Largest ElementEasy · java, python, c, cpp, javascriptSolve Problem
- Find the Smallest ElementEasy · java, python, c, cpp, javascriptSolve Problem
- Find the Second Largest ElementEasy · java, python, c, cpp, javascriptSolve Problem