Google interview question

Basic algorithm questions.