Skip to content
Use code for 50% offSee plans

Sliding Window Problems

133 Sliding Window LeetCode problems · Solve with AI-powered hints & step-by-step explanations.

Learn the coding interview patterns behind these problems.

Start with these

All Sliding Window problems

3 Longest Substring Without Repeating Characters Medium30 Substring with Concatenation of All Words Hard76 Minimum Window Substring Hard187 Repeated DNA Sequences Medium209 Minimum Size Subarray Sum Medium219 Contains Duplicate II Easy220 Contains Duplicate III Hard239 Sliding Window Maximum Hard395 Longest Substring with At Least K Repeating Characters Medium413 Arithmetic Slices Medium424 Longest Repeating Character Replacement Medium438 Find All Anagrams in a String Medium480 Sliding Window Median Hard567 Permutation in String Medium594 Longest Harmonious Subsequence Easy632 Smallest Range Covering Elements from K Lists Hard643 Maximum Average Subarray I Easy658 Find K Closest Elements Medium689 Maximum Sum of 3 Non-Overlapping Subarrays Hard713 Subarray Product Less Than K Medium718 Maximum Length of Repeated Subarray Medium837 New 21 Game Medium862 Shortest Subarray with Sum at Least K Hard904 Fruit Into Baskets Medium930 Binary Subarrays With Sum Medium978 Longest Turbulent Subarray Medium992 Subarrays with K Different Integers Hard995 Minimum Number of K Consecutive Bit Flips Hard1004 Max Consecutive Ones III Medium1016 Binary String With Substrings Representing 1 To N Medium1031 Maximum Sum of Two Non-Overlapping Subarrays Medium1040 Moving Stones Until Consecutive II Medium1044 Longest Duplicate Substring Hard1052 Grumpy Bookstore Owner Medium1156 Swap For Longest Repeated Character Substring Medium1208 Get Equal Substrings Within Budget Medium1234 Replace the Substring for Balanced String Medium1248 Count Number of Nice Subarrays Medium1297 Maximum Number of Occurrences of a Substring Medium1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold Medium1358 Number of Substrings Containing All Three Characters Medium1423 Maximum Points You Can Obtain from Cards Medium1425 Constrained Subsequence Sum Hard1438 Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Medium1456 Maximum Number of Vowels in a Substring of Given Length Medium1477 Find Two Non-overlapping Sub-arrays Each With Target Sum Medium1493 Longest Subarray of 1's After Deleting One Element Medium1499 Max Value of Equation Hard1610 Maximum Number of Visible Points Hard1652 Defuse the Bomb Easy1658 Minimum Operations to Reduce X to Zero Medium1695 Maximum Erasure Value Medium1703 Minimum Adjacent Swaps for K Consecutive Ones Hard1763 Longest Nice Substring Easy1838 Frequency of the Most Frequent Element Medium1839 Longest Substring Of All Vowels in Order Medium1871 Jump Game VII Medium1876 Substrings of Size Three with Distinct Characters Easy1888 Minimum Number of Flips to Make the Binary String Alternating Medium1984 Minimum Difference Between Highest and Lowest of K Scores Easy2009 Minimum Number of Operations to Make Array Continuous Hard2024 Maximize the Confusion of an Exam Medium2090 K Radius Subarray Averages Medium2106 Maximum Fruits Harvested After at Most K Steps Hard2134 Minimum Swaps to Group All 1's Together II Medium2156 Find Substring With Given Hash Value Hard2260 Minimum Consecutive Cards to Pick Up Medium2269 Find the K-Beauty of a Number Easy2271 Maximum White Tiles Covered by a Carpet Medium2302 Count Subarrays With Score Less Than K Hard2379 Minimum Recolors to Get K Consecutive Black Blocks Easy2398 Maximum Number of Robots Within Budget Hard2401 Longest Nice Subarray Medium2411 Smallest Subarrays With Maximum Bitwise OR Medium2444 Count Subarrays With Fixed Bounds Hard2461 Maximum Sum of Distinct Subarrays With Length K Medium2516 Take K of Each Character From Left and Right Medium2528 Maximize the Minimum Powered City Hard2537 Count the Number of Good Subarrays Medium2555 Maximize Win From Two Segments Medium2653 Sliding Subarray Beauty Medium2730 Find the Longest Semi-Repetitive Substring Medium2747 Count Zero Request Servers Medium2760 Longest Even Odd Subarray With Threshold Easy2762 Continuous Subarrays Medium2779 Maximum Beauty of an Array After Applying Operation Medium2781 Length of the Longest Valid Substring Hard2799 Count Complete Subarrays in an Array Medium2831 Find the Longest Equal Subarray Medium2841 Maximum Sum of Almost Unique Subarray Medium2875 Minimum Size Subarray in Infinite Array Medium2902 Count of Sub-Multisets With Bounded Sum Hard2904 Shortest and Lexicographically Smallest Beautiful String Medium2932 Maximum Strong Pair XOR I Easy2935 Maximum Strong Pair XOR II Hard2953 Count Complete Substrings Hard2958 Length of Longest Subarray With at Most K Frequency Medium2962 Count Subarrays Where Max Element Appears at Least K Times Medium2968 Apply Operations to Maximize Frequency Score Hard2981 Find Longest Special Substring That Occurs Thrice I Medium2982 Find Longest Special Substring That Occurs Thrice II Medium3013 Divide an Array Into Subarrays With Minimum Cost II Hard3086 Minimum Moves to Pick K Ones Hard3090 Maximum Length Substring With Two Occurrences Easy3095 Shortest Subarray With OR at Least K I Easy3097 Shortest Subarray With OR at Least K II Medium3134 Find the Median of the Uniqueness Array Hard3191 Minimum Operations to Make Binary Array Elements Equal to One I Medium3206 Alternating Groups I Easy3208 Alternating Groups II Medium3234 Count the Number of Substrings With Dominant Ones Medium3254 Find the Power of K-Size Subarrays I Medium3255 Find the Power of K-Size Subarrays II Medium3258 Count Substrings That Satisfy K-Constraint I Easy3261 Count Substrings That Satisfy K-Constraint II Hard3297 Count Substrings That Can Be Rearranged to Contain a String I Medium3298 Count Substrings That Can Be Rearranged to Contain a String II Hard3305 Count of Substrings Containing Every Vowel and K Consonants I Medium3306 Count of Substrings Containing Every Vowel and K Consonants II Medium3318 Find X-Sum of All K-Long Subarrays I Easy3321 Find X-Sum of All K-Long Subarrays II Hard3325 Count Substrings With K-Frequency Characters I Medium3346 Maximum Frequency of an Element After Performing Operations I Medium3347 Maximum Frequency of an Element After Performing Operations II Hard3364 Minimum Positive Sum Subarray Easy3411 Maximum Subarray With Equal Products Easy3413 Maximum Coins From K Consecutive Bags Medium3420 Count Non-Decreasing Subarrays After K Operations Hard3439 Reschedule Meetings for Maximum Free Time I Medium3445 Maximum Difference Between Even and Odd Frequency II Hard3505 Minimum Operations to Make Elements Within K Subarrays Equal Hard3578 Count Partitions With Max-Min Difference at Most K Medium3589 Count Prime-Gap Balanced Subarrays Medium