Two Pointers & Sliding Window Visualizers

11

Step through every Two Pointers & Sliding Window problem with animated runtime state, source highlighting, and curated test cases. Built for coding-interview prep and durable algorithmic intuition.

3Sum
Sort first, then lock one anchor and solve the remaining pair with inward pointers.
Sorted Two Pointers
Container With Most Water
Measure area with both outer walls, then move the shorter wall inward to search for a taller boundary.
Greedy Two Pointers
Find the Index of the First Occurrence in a String
Slide a short matching window across the haystack and compare the candidate substring.
Substring Scan
Is Subsequence
Advance the source string only when characters match; the target string keeps moving regardless.
Forward Two Pointers
Longest Repeating Character Replacement
Keep the window as large as possible while at most k characters differ from the most frequent letter inside it.
Sliding Window + Frequency Count
Longest Substring Without Repeating Characters
Expand the right edge, and whenever a duplicate appears, shrink the left edge until the window is valid again.
Sliding Window + Set
Permutation in String
Slide a fixed-size window and compare frequency balance with the target permutation.
Fixed Window Frequency Match
Sliding Window Maximum
Maintain a decreasing deque of indices so the current maximum is always at the front.
Sliding Window + Monotonic Deque
Trapping Rain Water
Track the best wall seen from both sides and trap water above shorter boundaries.
Two Pointers with Running Max
Two Sum
Scan once with a hashmap of seen values and resolve the complement the moment it appears.
Hash Map + Pair Scan
Two Sum II - Input Array Is Sorted
Use the sorted order to squeeze two pointers inward until the sum matches the target.
Opposing Two Pointers