Google interview question

Code assigment on site and some technical logics