DP World Interview Question

They asked a sliding window problem on array