Meta interview question

A string and graph related question