Gartner Interview Question

Python problem to find ngram