Citadel interview question

Sliding window question, and optimization methods