Intermediate DSA
- 1st Visit
- 0/147
- 2nd Visit
- 0/147
- Revise
- 0/147
01Sliding Window
0/14
A sliding window maintains a contiguous range [l, r] and updates a summary of it (a sum, a frequency table, a count of distinct items) incrementally as the right end…
Pattern guide02Binary Search on Answer
0/13
When the answer is a number and you can cheaply check whether a candidate value is feasible, binary search over the answer instead of over an array. The key is…
Pattern guide03Monotonic Stack
0/12
A monotonic stack keeps its elements in increasing or decreasing order; before pushing a new element, it pops every element the newcomer makes irrelevant. At the moment…
Pattern guide04Binary Trees
0/20
Binary tree problems are recursive by nature: every node has a left and a right subtree, and most answers combine results from the two subtrees with the value at the…
Pattern guide05Heap / Priority Queue
0/13
A binary heap, available in C++ as priority queue, returns the largest (or smallest) element in O(1) and supports insertion and removal in O(log n). Use it when you…
Pattern guide06Backtracking
0/14
Backtracking builds candidate solutions one choice at a time and abandons a partial candidate as soon as it cannot lead to a valid answer. It is a depth first search…
Pattern guide07Greedy
0/17
A greedy algorithm makes the locally best choice at each step and never revisits it. It is correct only when an exchange argument holds: any optimal solution can be…
Pattern guide08Graphs: BFS & DFS
0/17
A graph is a set of nodes joined by edges; grids, state spaces and number transformations are often graphs in disguise. Depth first search explores as far as possible…
Pattern guide091-D Dynamic Programming
0/15
Dynamic programming solves a problem by combining answers to overlapping subproblems, computing each one only once. In 1 D DP the state is a single index or value…
Pattern guide10Mixed Practice
All patterns0/12
This set closes the Intermediate level with twelve problems drawn from its patterns, including sliding windows, binary search on the answer, monotonic stacks, binary…
Pattern guide