Google Interview Questions

So, I had a phone interview with Google tonight, and I got off the phone thinking that one of the questions they asked was pretty indicative of the kind of thoughts that must be rolling around the Googleplex on a daily basis.

Assuming speed is more important that storage, how would you go about counting the (set) bits in a 32-bit integer as fast as possible? Assume that you will have to do this over and over again as fast as possible.

I thought this was interesting because the answer they are looking for is not what most would think of right away. Worded another way, the above question will pretty obviously lead to what Google wants to hear, but I think the above wording is on purpose. The other questions were uninteresting, but this one really backs up what Joel Spolsky had indicated the other day about the difference between Google and Microsoft’s thinking.

The best part about this whole thing is that I called a guy in SF to tell him about it, and he told me that he got almost the exact same question from Google during a phone interview 6 years ago. I guess they haven’t learned the lesson from Microsoft about using the same interview questions so much that the candidates show up shouting the answers from the parking lot ;-)