P16305 [GeeksforGeeks] Find unique pair in an array with pairs of numbers2425
普及-
题目描述

Given an array where every element appears twice except a pair (two elements). return the elements of this unique pair in sorted order.

Example 1:
Input : Arr[] = {2, 2, 5, 5, 6, 7}
Output : 6 7
Explanation:
We can see we have [2, 2, 5, 5, 6, 7].
Here 2 and 5 are coming two times.
So, the answer will be 6 7.
Example 2:
Input : Arr[] = {1, 3, 4, 1}
Output : 3 4
Your Task:
This is a function problem. The input is already taken care of by the driver code. You only need to complete the function findUniquePair() that takes an array (arr), sizeOfArray (n) and return the unique pair's element in increasing order. The driver code takes care of the printing.

Expected Time Complexity: O(n).
Expected Auxiliary Space: O(1).

Constraints:
1 ≤ N ≤ 10^{5}
1 ≤ A[i] ≤ 10^{7}

输入格式

见题面

输出格式

见题面

样例输入
Arr[] = {2, 2, 5, 5, 6, 7}
样例输出
6 7