Pregunta de entrevista de J.P. Morgan

Hackerrank assessment, something about sliding window