Goldman Sachs interview question

Kmp algorithm or implement grep