LinkedIn interview question

sliding window leetcode medium question