Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Want a job working on mongoDB? Your first online interview is in this post . Parent comment
Assume d XOR m = a. Find k = position of the first bit (from MSB to LSB) in a. Then d + m can be in [a + 2^(k+1),a + 2^(k+2),...,a + 2^63].
We will have less than 63 cases. In each case, after we find d and m, make sure they are in range and then linear test.
So in the end, we may need to run at most 63+3 = 66 N. But it still linear though.
There are no comments on this comment yet.
Assume d XOR m = a. Find k = position of the first bit (from MSB to LSB) in a. Then d + m can be in [a + 2^(k+1),a + 2^(k+2),...,a + 2^63].
We will have less than 63 cases. In each case, after we find d and m, make sure they are in range and then linear test.
So in the end, we may need to run at most 63+3 = 66 N. But it still linear though.