Google interview question

Two questions in a coding challange