Goldman Sachs Interview Question

Kmp algorithm or implement grep