Sliding Window Pattern

Maintain a dynamic subarray/substring window with add/remove invariants.

#Title
209Minimum Size Subarray Sum
424Longest Repeating Character Replacement
862Shortest Subarray with Sum at Least K
904Fruit Into Baskets
930Binary Subarrays With Sum
992Subarrays with K Different Integers
1004Max Consecutive Ones III
1151Minimum Swaps to Group All 1's Together
1156Swap For Longest Repeated Character Substring
1169Invalid Transactions
1176Diet Plan Performance
1208Get Equal Substrings Within Budget
1234Replace the Substring for Balanced String
1248Count Number of Nice Subarrays
1297Maximum Number of Occurrences of a Substring
1316Distinct Echo Substrings
1340Jump Game V
1358Number of Substrings Containing All Three Characters
1423Maximum Points You Can Obtain from Cards
1425Constrained Subset Sum
1456Maximum Number of Vowels in a Substring of Given Length
1493Longest Subarray of 1's After Deleting One Element
1508Range Sum of Sorted Subarray Sums
1521Find a Value of a Mysterious Function Closest to Target
1604Alert Using Same Key-Card Three or More Times in a One Hour Period
1610Maximum Number of Visible Points
1687Delivering Boxes from Storage to Ports
1695Maximum Erasure Value
1696Jump Game VI
1838Frequency of the Most Frequent Element
1852Distinct Numbers in Each Subarray
1888Minimum Number of Flips to Make the Binary String Alternatings
1984Minimum Difference Between Highest and Lowest of K Scores
1989Maximum Number of People That Can Be Caught in Tag
2009Minimum Number of Operations to Make Array Continuous
2024Maximize the Confusion of an Exam
2062Count Vowel Substrings of a String
2067Number of Equal Count Substrings
2090K Radius Subarray Averages
2107Number of Unique Flavors After Sharing K Candies
2134Minimum Swaps to Group All 1's Together II
2269Find the K-Beauty of a Number
2271Maximum White Tiles Covered by a Carpet
2302Count Subarrays With Score Less Than K
2379Minimum Recolors to Get K Consecutive Black Blocks
2398Maximum Number of Robots Within Budget
2401Longest Nice Subarray
2516Take K of Each Character From Left and Right
2524Maximum Frequency Score of a Subarray
2528Maximize the Minimum Powered City
2537Count the Number of Good Subarrays
2555Maximize Win From Two Segments
2743Count Substrings Without Repeating Character
2762Continuous Subarrays
2763Sum of Imbalance Numbers of All Subarrays
2772Apply Operations to Make All Array Elements Equal to Zero
2779Maximum Beauty of an Array After Applying Operation
2781Length of the Longest Valid Substring
2799Count Complete Subarrays in an Array
2831Find the Longest Equal Subarray
2836Maximize Value of Function in a Ball Passing Game
2841Maximum Sum of Almost Unique Subarray
2875Minimum Size Subarray in Infinite Array
2902Count of Sub-Multisets With Bounded Sum
2904Shortest and Lexicographically Smallest Beautiful String
2933High-Access Employees
2953Count Complete Substrings
2958Length of Longest Subarray With at Most K Frequency
2962Count Subarrays Where Max Element Appears at Least K Times
2968Apply Operations to Maximize Frequency Score
3013Divide an Array Into Subarrays With Minimum Cost II
3090Maximum Length Substring With Two Occurrences
3134Find the Median of the Uniqueness Array
3171Find Subarray With Bitwise OR Closest to K
3186Maximum Total Damage With Spell Casting
3193Count the Number of Inversions
3206Alternating Groups I
3208Alternating Groups II
3234Count the Number of Substrings With Dominant Ones
3254Find the Power of K-Size Subarrays I
3255Find the Power of K-Size Subarrays II
3258Count Substrings That Satisfy K-Constraint I
3261Count Substrings That Satisfy K-Constraint II
3264Final Array State After K Multiplication Operations I
3266Final Array State After K Multiplication Operations II
3291Minimum Number of Valid Strings to Form Target I
3292Minimum Number of Valid Strings to Form Target II
3297Count Substrings That Can Be Rearranged to Contain a String I
3298Count Substrings That Can Be Rearranged to Contain a String II
3305Count of Substrings Containing Every Vowel and K Consonants I
3306Count of Substrings Containing Every Vowel and K Consonants II
3318Find X-Sum of All K-Long Subarrays I
3321Find X-Sum of All K-Long Subarrays II
3323Minimize Connected Groups by Inserting Interval
3325Count Substrings With K-Frequency Characters I
3329Count Substrings With K-Frequency Characters II
3346Maximum Frequency of an Element After Performing Operations I
3347Maximum Frequency of an Element After Performing Operations II
3364Minimum Positive Sum Subarray
3413Maximum Coins From K Consecutive Bags
3420Count Non-Decreasing Subarrays After K Operations
3422Minimum Operations to Make Subarray Elements Equal
3425Longest Special Path
3428Maximum and Minimum Sums of at Most Size K Subsequences
3430Maximum and Minimum Sums of at Most Size K Subarrays
3439Reschedule Meetings for Maximum Free Time I
3445Maximum Difference Between Even and Odd Frequency II
3464Maximize the Distance Between Points on a Square
3474Lexicographically Smallest Generated String
3485Longest Common Prefix of K Strings After Removal
3486Longest Special Path II
3567Minimum Absolute Difference in Sliding Submatrix
3578Count Partitions With Max-Min Difference at Most K
3584Maximum Product of First and Last Elements of a Subsequence
3589Count Prime-Gap Balanced Subarrays
3634Minimum Removals to Balance Array
3640Trionic Array II
3641Longest Semi-Repeating Subarray
3649Number of Perfect Pairs
3652Best Time to Buy and Sell Stock using Strategy
3672Sum of Weighted Modes in Subarrays
3679Minimum Discards to Balance Inventory
3740Minimum Distance Between Three Equal Elements I
3741Minimum Distance Between Three Equal Elements II
3768Minimum Inversion Count in Subarrays of Fixed Length
3795Minimum Subarray Length With Distinct Sum At Least K
3817Good Indices in a Digit String
3835Count Subarrays With Cost Less Than or Equal to K
3845Maximum Subarray XOR with Bounded Range
3851Maximum Requests Without Violating the Limit
3853Merge Close Characters
3859Count Subarrays With K Distinct Integers
3888Minimum Operations to Make All Grid Elements Equal
3937Minimum Operations to Make Array Modulo Alternating I
3944Minimum Operations to Make Array Modulo Alternating II
3969Valid Subarrays With Matching Sum Digits I
3972Valid Subarrays With Matching Sum Digits II