Amazon interview question

The sliding window problem from leetcode.