ODD ONE OUT

3

2 votes
Easy
Problem

In an array of length (2n+1), n numbers are present twice and one number is present only once. You need to find and print the unique element without taking any extra spaces and in linear time.

Input Format:

First line contains the number n. Second line contains n space separated number.

Constraints:

n < 10^5

Output Format:

Output a single line containing the unique number

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Sample Input:

7
1 1 2 2 3 3 4

Sample Output:

4

Answer:

4 is present only once

Editor Image

?