The stress test gets worse: now TWO faulty sensors each log only once, while everything else logs twice — Nusrat must recover both faulty IDs, still using pure bitwise tricks. Read N integers where every value appears EXACTLY TWICE except TWO values which each appear exactly once. Find both unique values (in any order) in O(N) time, O(1) extra space, using bitwise tricks only.
Input
Line1: N (N is even+2 effectively). Line2: N integers.
Output
The two unique values, space-separated (either order).
Constraints
1 ≤ N ≤ 2×10^5
Sample Input
6 1 2 1 3 2 5
Sample Output
3 5
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.