Google interview question

more on puzzle and also technical coding and also scenario based coding