Yelp Interview Question

Leet code style n-gram type problem.