J.P. Morgan interview question

Hackerrank assessment, something about sliding window