American Express interview question

sliding window and leetcode easy