Google interview question

Simple algorithmic questions