Pergunta de entrevista da empresa Toptal

Sliding window problem + simple data structure question.