Optiver interview question

In Hackerrank OA, first question was on KMP algorithm, second was on regression