Google interview question

programming algorithms