Google Interview Question

You must solve the problem in 45 minutes.