Sliding Window
Keep a window over part of an array or string, and move its edges instead of starting over each time. It turns many 'every substring' problems from quadratic to linear. Look for a contiguous range with a limit, like Longest Substring Without Repeating Characters.
27 problems · 11 with a video · 4 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Longest Substring Without Repeating Characters | Medium | AI round | |
| 2 | Sliding Window Maximum | Hard | AI round | |
| 3 | Minimum Window Substring | Hard | AI round | |
| 4 | Minimum Size Subarray Sum | Medium | AI round | |
| 5 | Longest Repeating Character Replacement | Medium | ||
| 6 | Find All Anagrams in a String | Medium | ||
| 7 | Permutation in String | Medium | — | |
| 8 | Max Consecutive Ones III | Medium | ||
| 9 | Find K Closest Elements | Medium | — | |
| 10 | Contains Duplicate II | Easy | — | |
| 11 | Subarray Product Less Than K | Medium | — | |
| 12 | Maximum Points You Can Obtain from Cards | Medium | — | |
| 13 | Subarrays with K Different Integers | Hard | — | |
| 14 | Longest Substring with At Least K Repeating Characters | Medium | — | |
| 15 | Fruit Into Baskets | Medium | ||
| 16 | Frequency of the Most Frequent Element | Medium | — | |
| 17 | Count Number of Nice Subarrays | Medium | — | |
| 18 | Shortest Subarray with Sum at Least K | Hard | — | |
| 19 | Binary Subarrays With Sum | Medium | — | |
| 20 | Maximum Average Subarray I | Easy | ||
| 21 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Medium | — | |
| 22 | Smallest Range Covering Elements from K Lists | Hard | — | |
| 23 | Maximum Number of Vowels in a Substring of Given Length | Medium | ||
| 24 | Maximize the Confusion of an Exam | Medium | ||
| 25 | Longest Substring with At Most K Distinct Characters | Medium | — | |
| 26 | Longest Substring with At Most Two Distinct Characters | Medium | — | |
| 27 | Max Consecutive Ones II | Medium | — |
Sort by what interviews ask
Sign in to see how many companies ask each problem, sort all 500 by it or by likes, and tick off what you solve.
Practice in an AI round
Four of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Longest Substring Without Repeating Characters in an AI roundYour first AI round is free.