Technical Interviews: More Than a Brain Teaser?
goodmath.org
goodmath.org
bin(x ^ (x >> 1))
Most often interviewers get quite irritated if interviewer comes up with a much simplier and a faster solution than what was intended.Coming up with an unusual solution should be a win, though it's of course not required.
Also, in some cases I might ask a slightly harder follow-up where the shortcut doesn't work.