Meta interview question

string manipulation and graph traversal