Google interview question

string mutilation and graph question