Pergunta de entrevista da empresa Yelp

Trasverse graph algorithm question for the first interview.