## Repeated digits

Given a non-empty array of integers, every element appears two times except for one, which appears exactly once. Find that single one, ine linear time, with no extra memory.

#### Input Specification

The first line of the input file contains one integer \(N\) the size of the array A. The next line contains \(N\) space separated integers \(a_i\) (\(1 \leq a_i \leq 10^5\)).

#### Output Specification

Output one line with one integer : the element that occurs exactly once.

#### Sample Input

```
7
2 2 3 3 4 4 1
```

#### Sample Output

`1`

## Comments

there is smt wrong abt input in python in this problem it's kind of weird, try using

deleted

deleted

Why I got ValueError as a result ?

could you please tell me what is the 'cnt' array ? Edit : Nerver mind xor made the job

please where is the problem in my code!

First of all your code won't pass cause it's O(N^2) which will lead to Time limit exceeded. Secondly you use

`num = list(input().split(" "))`

actually the input().split() by default separate the input by single spaces and then it return a list of Strings so to read Ints you can either use this`num = list(map(int,input().split())`

or`num = [*map(int,input().split())]`

or`num = [int(i) for i in input().split()]`

and you need to change your code because it won't pass, Try to read about the operation XOR and re-attempt the problemAny hint guys the program give me value error the time complexity is linear

"Find that single one, in linear time, with no extra memory" , while you stored the occurence of numbers in a map .

bro, I didn't understand

You shouldn't use the "cnt" array , as it has a linear memory complexity . It is required to solve it in O(1) .

I don't understand this problem. For the test case 2, my program gives 5 as an answer, and I checked that it appears only once in the input, yet I get WA as a result. Any ideas why? Aside from that \(a_i\) is not less than \(10^5\). There are elements larger than that.

"Find that single one, in linear time, with no extra memory" , while you used an array of size 1e5.

Hmm I see. It should give a memory limit or something in that case, not WA because it's misleading. Thank you!

I think the constraints of

Nshould be stated.wait is a < N ??

in short it is necessary to write the number which appears only once in the list , that mean is necessary to a[i] appears once in the array and N is the length of the array (a.length() == a) .

i don't think there is a solution for python users because of the input format i need a clarification please

input()

numbers = [i for i in map(int, input().split())]

using map give me a valueError because of the memory limit

the elements that appears two times , should always be next to each other ?

no, it's not said in the statement.