Pregunta de entrevista de Citadel

Sliding window question, and optimization methods