


Given an array 'ARR' of integers of size N in which two elements appear exactly once and all other elements appear exactly twice. Your task is to find the two elements that appear only once.
Note 1. Input will always have only two integers that appear exactly once rest will appear twice.
2. Try to do this in linear time and constant space.
The first line of input contains an integer N representing the size of the array.
The second line of input contains an N space-separated integers representing the array elements.
Output Format:
Print the two space-separated elements that appear only once where the first integer is less than the second integer.
2 <= N <= 10^5
-10^5 <= ARR[i] <= 10^5
Time Limit: 1 sec
8
2 4 6 8 10 2 6 10
4 8
4 and 8 appear only once in the array and rest all other elements appear twice in the array and 4 is printed first because it is smaller than the other element 8.
4
-1 -1 5 3
3 5
3 and 5 appear only once in the array and rest all other elements appear twice in the array and 3 is printed first because it is smaller than the other element 5.
Try to do using the brute force method maybe using two for loop?
O(N^2), where N is the size of the array.
We are using two nested for loops of size N each in each iteration therefore the time complexity here becomes of the order O(N^2).
O(1), We are using constant extra space.