Intuit interview question

I felt the Bit manipulation question was a bit tricky.