Google interview question

Recursion and some bit logic problem