Yelp interview question

Pretty straightforward BFS graph question