Two Pointers
Walk two indices through the data, usually from both ends or at different speeds, and decide which one to move at each step. It fits sorted arrays, pairs that meet a target, and in-place edits, as in 3Sum. It replaces a nested loop with one pass.
53 problems · 30 with a video · 6 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Trapping Rain Water | Hard | AI round | |
| 2 | 3Sum | Medium | AI round | |
| 3 | Container With Most Water | Medium | AI round | |
| 4 | Longest Palindromic Substring | Medium | AI round | |
| 5 | Find the Duplicate Number | Medium | AI round | |
| 6 | Sort Colors | Medium | AI round | |
| 7 | Next Permutation | Medium | — | |
| 8 | Remove Nth Node From End of List | Medium | ||
| 9 | Rotate Array | Medium | — | |
| 10 | Move Zeroes | Easy | ||
| 11 | Merge Sorted Array | Easy | — | |
| 12 | Palindrome Linked List | Easy | ||
| 13 | Linked List Cycle | Easy | ||
| 14 | Intersection of Two Linked Lists | Easy | ||
| 15 | Linked List Cycle II | Medium | ||
| 16 | Two Sum II - Input Array Is Sorted | Medium | ||
| 17 | Middle of the Linked List | Very easy | ||
| 18 | Sort List | Medium | — | |
| 19 | 4Sum | Medium | — | |
| 20 | Reorder List | Medium | ||
| 21 | Happy Number | Easy | ||
| 22 | Valid Palindrome | Easy | ||
| 23 | 3Sum Closest | Medium | ||
| 24 | Palindromic Substrings | Medium | ||
| 25 | Rotate List | Medium | — | |
| 26 | Partition Labels | Medium | ||
| 27 | Is Subsequence | Easy | ||
| 28 | Reverse Words in a String | Medium | — | |
| 29 | Squares of a Sorted Array | Very easy | ||
| 30 | Reverse String | Very easy | — | |
| 31 | Remove Duplicates from Sorted List II | Medium | ||
| 32 | Valid Palindrome II | Easy | ||
| 33 | Remove Duplicates from Sorted Array II | Medium | — | |
| 34 | Backspace String Compare | Easy | ||
| 35 | Longest String Chain | Medium | — | |
| 36 | Two Sum IV - Input is a BST | Easy | — | |
| 37 | Intersection of Two Arrays | Easy | — | |
| 38 | Boats to Save People | Medium | ||
| 39 | Reverse Words in a String III | Very easy | ||
| 40 | Sort Array By Parity | Very easy | — | |
| 41 | Assign Cookies | Easy | — | |
| 42 | Delete the Middle Node of a Linked List | Medium | — | |
| 43 | Merge Strings Alternately | Very easy | — | |
| 44 | Count Binary Substrings | Easy | — | |
| 45 | Partition Array Into Two Arrays to Minimize Sum Difference | Hard | — | |
| 46 | Sum of Square Numbers | Medium | ||
| 47 | Find the Celebrity | Medium | — | |
| 48 | Reverse Only Letters | Easy | ||
| 49 | Reverse Prefix of Word | Very easy | ||
| 50 | Lowest Common Ancestor of a Binary Tree III | Medium | — | |
| 51 | One Edit Distance | Medium | — | |
| 52 | Sort Transformed Array | Medium | — | |
| 53 | Last Substring in Lexicographical Order | Very hard | — |
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
Six of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Trapping Rain Water in an AI roundYour first AI round is free.