Sliding Window • Intermediate • 20 min
Longest Substring Without Repeating Characters
How to notice that the problem asks for a window that expands and contracts, not a full restart at every repetition.
Practice problems with walkthroughs, hints, and solutions.
Filter by type or level
Sliding Window • Intermediate • 20 min
How to notice that the problem asks for a window that expands and contracts, not a full restart at every repetition.
Arrays and Two Pointers • Intermediate • 25 min
How to reduce a three-variable problem into [two pointers](/glossary/two-pointers) after sorting and handling duplicates in a controlled way.
Arrays and Two Pointers • Intermediate • 18 min
How to justify why only the shorter side makes sense to move and use that to shrink the search.
Hash Map • Intermediate • 18 min
How to notice that the real point is not the map itself, but choosing a canonical key that represents the group.
Arrays and Prefix/Suffix • Intermediate • 20 min
How to use prefix and suffix products to build the local answer for each index from the surrounding context.
Intervals • Intermediate • 20 min
How to sort by start time and turn many intervals into one pass that either expands the current block or opens a new one.
Linked List • Intermediate • 15 min
How to detect a cycle with fast and slow pointers and understand why different speeds eventually meet.
Dynamic Programming • Intermediate • 25 min
How to move away from blind combinations and build a DP that searches for the minimum cost for each value up to the target.
Graphs on a Grid • Intermediate • 22 min
How to see each cell as a graph node and use DFS or BFS to consume one whole island at a time.
Trees • Intermediate • 20 min
How to validate a BST by propagating limits through recursion instead of doing local comparisons that look right but break.
Trees • Intermediate • 18 min
How to traverse a tree level by level with a queue and clearly separate what belongs to the current level before moving down.
Heap and Frequency • Intermediate • 20 min
How to count frequency first and then choose only the top K efficiently.
Stack • Intermediate • 15 min
How to keep the minimum updated in O(1) with a simple helper structure instead of scanning the whole stack.
Stack • Intermediate • 15 min
How to compose two stacks to simulate a queue and understand why lazy transfer keeps the amortized cost low.
Dynamic Programming • Intermediate • 18 min
How to model the choice between robbing or skipping each house while respecting the adjacency constraint.
Search • Intermediate • 22 min
How to adapt binary search when the full order is broken by a rotation but not completely gone.
Backtracking • Intermediate • 25 min
How to explore paths in a grid, mark the current choice, and undo that choice on the way back.
Data Structure Design • Intermediate • 30 min
How to combine a hash map with a doubly linked list for fast lookup and fast recency updates.
Graphs • Intermediate • 25 min
How to turn prerequisites into a directed graph and detect when a dependency comes back to itself.
Backtracking • Intermediate • 20 min
How to use counter-based backtracking to prune invalid prefixes before they turn into wasted work.
Strings and Expansion • Intermediate • 22 min
How to notice that every palindrome has a center and use that to avoid a heavier [dynamic programming](/glossary/dynamic-programming) solution than necessary.
Dynamic Programming • Intermediate • 22 min
How to turn string segmentation into prefix [dynamic programming](/glossary/dynamic-programming) instead of retrying the same cut over and over.
Matrix • Intermediate • 20 min
How to decompose a matrix rotation into simpler transformations and do it in place with clear coordinate mapping.
Dynamic Programming • Intermediate • 25 min
How to turn comparison between two strings into a table of subproblems instead of repeating [recursion](/glossary/recursion) choices.