Cobblestone Energy Interview Question

Standard sliding window problem from leetcode