Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given an array of ‘N’ non-negative integers where all elements appear an even number of times except two, print the two odd occurring elements in increasing order. It may be assumed that the size of the array is at-least two and there will always be exactly two numbers which appear an odd number of times in the given array.

```
Input: 'N' = 6, 'NUMS' = [1, 1, 2, 3, 4, 4]
Output: 2 3
Here in the given array we can see that 2 and 3 occur 1 time which is an odd number. Hence, the output will be 2 and 3.
```

Detailed explanation

```
1 <= 'T' <= 10
2 <= 'N' <= 10^4
1 <= 'NUMS[i]' <= 10^5
Time Limit: 1 sec
```

```
2
6
1 1 2 3 4 4
2
1 2
```

```
2 3
1 2
```

```
For the first test case,
'N' = 6 and 'NUMS' = [1, 1, 2, 3, 4, 4]
Here in the given array we can see that 2 and 3 occur 1 time which is an odd number. Hence, the output will be 2 and 3.
For the second test case,
'N' = 2 and 'NUMS' = [1, 2]
Here in the given array we can see that 1 and 2 occur 1 time which is an odd number. Hence, the output will be 1 and 2.
```

```
2
4
8 2 2 7
4
3 1 3 5
```

```
7 8
1 5
```