Google interview question

It was a leet code problem