Please correct my solution and send it to me

Mike has got an array A of n numbers where binary representations of two consecutive numbers differ by only one bit. Now, he has a problem for you. He wants you to tell if there exists four numbers A[i1],A[ i2], A[i3],A[ i4] such that xor of these numbers is equal to 0. You can find this problem here.

Input Format
First line contains one integer n. Second line contains n space separated non-negative integers denoting the sequence A.

Constraints
4 <= n <= 100000

Output Format
Output YES if there exist four distinct indices i1, i2, i3, i4 such that A[i1] xor A[i2] xor A[i3] xor A[i4] = 0. Otherwise, output NO.

Sample Input
5
1 0 2 3 7
Sample Output
YES

solution

hello @Somasree

once check ur link …

Sorry


this is the linlk

in line 28, put that xor statement in paranthesis and then try

please suggest any better approach for this

…

u can remove the 4th loop using binary search.
sort the arraY AND then use 3loop to fix 3 values and then find 4th value using binary search…