4 subtopics · 17 problems
Two Pointers & Sliding Window
Linear-time scanning with two converging or co-moving pointers.
01Two Pointers — Opposite Direction
Left pointer moves right, right pointer moves left.
2 easy2 medium1 hard
| Problem | Difficulty | Link |
|---|---|---|
| 6CAlice, Bob and Chocolate | easy | Solve |
| 1850CWord on the Paper | easy | Solve |
| 1851DPrefix Permutation Sums | medium | Solve |
| 1462CUnique Number | medium | Solve |
| 1904DSet To Max | hard | Solve |
02Two Pointers — Same Direction
Both pointers move forward; often used for merging or matching.
2 easy1 medium1 hard
| Problem | Difficulty | Link |
|---|---|---|
| 279BBooks | easy | Solve |
| 1921CSending Messages | easy | Solve |
| 1829DGold Rush | medium | Solve |
| 1881FMinimum Maximum Distance | hard | Solve |
03Sliding Window — Fixed Size
Maintain a window of size k and slide it across the array.
1 easy2 medium1 hard
| Problem | Difficulty | Link |
|---|---|---|
| 1851BParity Sort | easy | Solve |
| 1862CFlower City Fence | medium | Solve |
| 1352CK-th Not Divisible by n | medium | Solve |
| 1862EKolya and Movie Theatre | hard | Solve |
04Sliding Window — Variable Size
Expand and shrink the window based on a condition.
2 medium2 hard
| Problem | Difficulty | Link |
|---|---|---|
| 1873EBuilding an Aquarium | medium | Solve |
| 1843ETracking Segments | medium | Solve |
| 602BApproximating a Constant Range | hard | Solve |
| 1886CIs It Flower? | hard | Solve |
Was this helpful?