Google Interview Question

Question from Cracking the Coding Interview