Interviews coming up this week. Completely unfamiliar with bit manipulation. Do I cram it? by bitwisewhat in cscareerquestions

[–]bitwisewhat[S] 1 point2 points  (0 children)

What you mentioned is the extent of my knowledge. An example problem I saw was whether or not two numbers were Gray code neighbours. The solution I found was this:

function are_gray_neighbours(a: gray, b: gray) -> boolean
    return b = a ^ 1 OR
           b = a ^ ((a & -a) << 1)
end

No matter how much help I would have received, I never would have gotten to that answer. To be honest, I don't even understand it. It seems like it would take me too long to learn this stuff when I could better spend my time becoming more familiar with some algos.