Pergunta de entrevista da empresa Oracle

It was something related to a sliding window, a medium-level LeetCode