Google interview question

Ques was on strings and it was leetcode hard question.