How to solve the following problem ?↵
Given an array of size N having integer elements A[1], A[2] , …, A[N] find the maximum value of↵
( (A[1] xor X) + (A[2] xor X) + (A[3] xor X)+ … + (A[N-1] xor X) + (A[N] xor X) ) for some X belonging to [L,R] .↵
constraints-↵
N <= 100000,↵
1 <= A[i], L, R <= 1000000000 .↵
A good follow up ques to try is https://www.codechef.com/problems/CHANDF
Given an array of size N having integer elements A[1], A[2] , …, A[N] find the maximum value of↵
( (A[1] xor X) + (A[2] xor X) + (A[3] xor X)+ … + (A[N-1] xor X) + (A[N] xor X) ) for some X belonging to [L,R] .↵
constraints-↵
N <= 100000,↵
1 <= A[i], L, R <= 1000000000 .↵
A good follow up ques to try is https://www.codechef.com/problems/CHANDF