Dsa
Bit Manipulation
Hard
Minimum XOR Pair Difference
Given an array of integers, find the two distinct elements in the array that produce the minimum XOR value and return that value. Your solution must run in O(n log n) time.
Input format: The first line contains integer 'n' (2 <= n <= 1000). The second line contains 'n' space-separated integers.
Output format: A single integer representing the minimum XOR value.
Example: For input '4
4 1 2 3', the minimum XOR is obtained from pairs (2, 3) or (3, 2), both yielding '1'. So the output is '1'.
Key concepts
bit manipulationxor
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now