Any approach for this question? Needed ASAP !!!!

Revision en3, by reaper28, 2023-10-09 14:37:51

Given an array A of N positive numbers and an integer P. Let NumPairs, be the number of pairs of elements of array A, such that their bitwise xor equal to X. You need to find the largest X, such that NumPairsx is greater or equal to P. If no such X exists print -1. Constraints:

N <=10 pow 4 P <=10 pow 9 Ai <=10 pow 9

Example:

A [1,12,13,14], P=1

QUESTION IS FROM PREVIOUS YEAR COMPANY QUESTIONS NOT FROM ANY ONGOING CONTEST

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English reaper28 2023-10-09 14:37:51 83
en2 English reaper28 2023-10-09 14:20:18 2 Tiny change: ' <=10 pow 5\nP <=10 ' -> ' <=10 pow 4\nP <=10 '
en1 English reaper28 2023-10-09 14:19:31 412 Initial revision (published)