Yelp interview question

It is just an algorithm question.