We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
May be I understood something worng ..
Here is the steps of my solution:
1. I got the array of numbers A
2. I Xor first element with the rest of elements starting from element two, and then the second element with the rest of the elements starting element three, and so on.
3. Now I have a list with all numbers xored, I sort them and get the first element in xored list and applied this equation to it :-
int k = (int) log (xoredList[0]) / log (2);
and in the second test case it gives me 9 not 25
I think, I miss understand something .. can anyone help me ?!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Manipulative Numbers
You are viewing a single comment's thread. Return to all comments →
Why the second test case answer is 25 ?
May be I understood something worng .. Here is the steps of my solution: 1. I got the array of numbers A 2. I Xor first element with the rest of elements starting from element two, and then the second element with the rest of the elements starting element three, and so on. 3. Now I have a list with all numbers xored, I sort them and get the first element in xored list and applied this equation to it :- int k = (int) log (xoredList[0]) / log (2);
and in the second test case it gives me 9 not 25
I think, I miss understand something .. can anyone help me ?!