DSA
300
3+ months
Pattern Wise 300
300 problems across every major pattern for complete, in-depth preparation.
300Problems
49Groups
48Easy
196Medium
56Hard
0%0 / 300
01Array Manipulation
10
Instinct "In place", "O(1) extra space" or "one pass" over an array? Think write pointer, reversal, prefix/suffix passes or using indices as storage.Memory hack Read fast, write slow, reverse to rotate, and let the index be the hash.Open the Array Manipulation guide →
- 1Move ZeroesEasy
- 2Majority ElementEasy
- 3Remove Duplicates from Sorted ArrayEasy
- 4Best Time to Buy and Sell StockEasy
- 5Rotate ArrayMedium
- 6Product of Array Except SelfMedium
- 7Best Time to Buy and Sell Stock IIMedium
- 8Number of Zero-Filled SubarraysMedium
- 9Increasing Triplet SubsequenceMedium
- 10First Missing PositiveHard
02String Manipulation
6
Instinct Reading, comparing or rebuilding text character by character? Walk indices on a char[] and build output with a StringBuilder, never with + in a loop.Memory hack Chars in an array, pointers on the ends, builder at the back - strings are just arrays wearing a costume.Open the String Manipulation guide →
03Hashing & Counting
13
Instinct Need "have I seen this before?", "how many times?" or "group things that look alike"? Trade memory for O(1) lookups with a HashMap, HashSet or int[26].Memory hack Don't search, remember - every element checks in at the front desk, and the desk answers instantly.Open the Hashing & Counting guide →
- 17Design HashMapEasy
- 18Maximum Number of BalloonsEasy
- 19Number of Good PairsEasy
- 20Isomorphic StringsEasy
- 21Ransom NoteEasy
- 22Contains Duplicate IIEasy
- 23Group AnagramsMedium
- 24Encode and Decode TinyURLMedium
- 25Reorganize StringMedium
- 26Longest Consecutive SequenceMedium
- 27Split Array into Consecutive SubsequencesMedium
- 28Number of Matching SubsequencesMedium
- 29Number of Good Ways to Split a StringMedium
04Two Pointers
5
Instinct Sorted input, a pair/triple hitting a target, or something symmetric? Put one pointer at each end and move the one that can only improve things.Memory hack Squeeze from both ends - every step throws away a whole row of the brute-force grid.Open the Two Pointers guide →
05Sliding Window
10
Instinct Longest, shortest or count of contiguous subarrays/substrings meeting a rule? Grow a window on the right, shrink it on the left, never step back.Memory hack Move like a caterpillar - the head stretches forward to grab, the tail pulls up only when the body breaks the rule.Open the Sliding Window guide →
- 35Maximum Average Subarray IEasy
- 36Find All Anagrams in a StringMedium
- 37Permutation in StringMedium
- 38Maximum Sum of Distinct Subarrays With Length KMedium
- 39Longest Substring Without Repeating CharactersMedium
- 40Longest Repeating Character ReplacementMedium
- 41Minimum Size Subarray SumMedium
- 42Max Consecutive Ones IIIMedium
- 43Substring with Concatenation of All WordsHard
- 44Minimum Window SubstringHard
06Prefix Sum
5
Instinct Repeated range-sum queries, or "count subarrays whose sum equals / divides K" with negatives allowed? Store running totals and subtract two of them.Memory hack Any range is two prefixes apart - sum(i..j) = P[j+1] - P[i], so remember every P you've passed.Open the Prefix Sum guide →
07Kadane's Running Best
4
Instinct Best sum or product of a contiguous subarray in one pass? At each index choose - extend the run ending here or restart - and track the global best.Memory hack Carry the bag only while it helps - a negative past is dead weight, drop it and restart here.Open the Kadane's Running Best guide →
08Matrix Traversal
5
Instinct A 2D grid you must walk in a fixed geometric order (spiral, diagonal, layer, rotate) or update in place - think boundaries, direction vectors and index maths.Memory hack Walk the walls, then shrink the room - four fences (top, bottom, left, right) close in after every lap.Open the Matrix Traversal guide →
09Bit Manipulation
7
Instinct Pairs that cancel, counting 1s, powers of two, subsets as numbers, or 'no + or - allowed' - drop to binary and use XOR, AND, OR and shifts.Memory hack XOR is a forgetful twin detector - see something twice and it vanishes; n & (n-1) snips off the last lit bulb.Open the Bit Manipulation guide →
10Bucket & Counting Sort
3
Instinct Keys live in a small, known range (letters, frequencies 1..n, bounded values) - index an array by the key instead of comparing, and get O(n).Memory hack Don't compare, just file it - every value walks straight to its own pigeonhole, then you read the shelves in order.Open the Bucket & Counting Sort guide →
11Linked List Techniques
14
Instinct Nodes joined by next pointers and the task is to reverse, splice, merge, reorder or remove in place - grab a dummy head and rewire pointers carefully.Memory hack Save next, flip, step - never let go of a rope before you've grabbed the next one.Open the Linked List Techniques guide →
- 69Intersection of Two Linked ListsEasy
- 70Palindrome Linked ListEasy
- 71Reverse Linked ListEasy
- 72Design Linked ListMedium
- 73Remove Nth Node From End of ListMedium
- 74Remove Duplicates from Sorted List IIMedium
- 75Swap Nodes in PairsMedium
- 76Copy List with Random PointerMedium
- 77Partition ListMedium
- 78Rotate ListMedium
- 79Add Two NumbersMedium
- 80Flatten a Multilevel Doubly Linked ListMedium
- 81Reverse Linked List IIMedium
- 82Reverse Nodes in k-GroupHard
12Fast & Slow Pointers
3
Instinct A next-step function you can follow (list nodes, digit-square sums, array-as-pointers) and you need a cycle, its entry, or the middle in O(1) space.Memory hack Tortoise and hare - on a loop track the hare laps the tortoise; restart the tortoise at the gate and they meet at the loop's door.Open the Fast & Slow Pointers guide →
13Stack
8
Instinct Things resolve in reverse order of arrival (brackets, adjacent pairs, nested expressions) - push now, pop when its partner shows up.Memory hack Last in, first out - like a pile of plates, you only ever touch the one on top; every closer pops its opener.Open the Stack guide →
14Monotonic Stack
6
Instinct Each element needs its nearest bigger or smaller neighbour (next warmer day, span, widest bar) - keep a sorted stack of waiting indices.Memory hack Tall people block the view - a newcomer kicks out everyone shorter waiting behind, and each kicked-out person just found their answer.Open the Monotonic Stack guide →
15Queue & Monotonic Deque
7
Instinct Arrival order matters, or you need the max/min of a moving window - reach for a FIFO queue, or a deque of indices kept in sorted order.Memory hack Old ones leave by the front door, weak ones get bounced out the back - so whoever stands at the front is always the champion.Open the Queue & Monotonic Deque guide →
16Data Structure Design
8
Instinct Implement a class whose methods must all hit a time bound (often O(1)) - write each method's target cost, then glue a hash map to a structure that keeps order.Memory hack Finder plus keeper - a hash map finds it fast, a list/heap/array keeps the order, and every method updates both.Open the Data Structure Design guide →
17Binary Search
10
Instinct Sorted data, a rotated array, or find the min/max X that works where a yes/no test flips only once - halve the search space every step.Memory hack Find the fence - every candidate reads NO NO NO YES YES, and binary search just walks to where the fence stands.Open the Binary Search guide →
- 115Search Insert PositionEasy
- 116Find First and Last Position of Element in Sorted ArrayMedium
- 117Search in Rotated Sorted ArrayMedium
- 118Find Peak ElementMedium
- 119Random Pick with WeightMedium
- 120Koko Eating BananasMedium
- 121Find Minimum in Rotated Sorted ArrayMedium
- 122Search a 2D MatrixMedium
- 123Find in Mountain ArrayHard
- 124Median of Two Sorted ArraysHard
18Recursion & Divide and Conquer
8
Instinct If the answer for n items can be built from the same problem on halves (or smaller pieces) plus a cheap combine step - split, recurse, merge.Memory hack Split it, trust it, stitch it - nail the base case, take the leap of faith on smaller calls, then glue their answers together.Open the Recursion & Divide and Conquer guide →
19Partitioning & Quickselect
2
Instinct Need the k-th smallest/largest, an unordered top-k, or values grouped into buckets in place - partition around a pivot and chase only one side.Memory hack Pivot, partition, pick a side - quickselect is quicksort's lazy cousin that only chases the half holding k.Open the Partitioning & Quickselect guide →
20Backtracking
8
Instinct Return ALL combinations, permutations, partitions or placements - or ask if any arrangement works - build a candidate step by step and undo each choice.Memory hack Choose, explore, un-choose - walk the decision tree and snip a branch the moment it can no longer succeed.Open the Backtracking guide →
21Greedy
7
Instinct An optimisation where one obvious local rule (earliest end, farthest reach, biggest first) never needs undoing - commit to it, then try hard to break it.Memory hack Grab the best bite now and never look back - but only once a counterexample hunt fails to make you regret it.Open the Greedy guide →
22Intervals & Line Sweep
7
Instinct See [start, end] pairs, meetings, bookings or the word "overlap"? Sort by an endpoint, then sweep left to right carrying one running fact.Memory hack Sort, then sweep - start time to merge, end time to choose, +1/-1 events to count the crowd.Open the Intervals & Line Sweep guide →
23Tree BFS (Level Order)
5
Instinct The answer talks about levels, rows, depth order, "closest to the root" or what you see from a side? Queue the tree and process it one level at a time.Memory hack Freeze the size, drain the row - read n = queue.size() before the loop and one level never bleeds into the next.Open the Tree BFS (Level Order) guide →
24Tree DFS
20
Instinct If the answer for a node can be built from the answers of its left and right subtrees, write one recursive function and trust it on the children.Memory hack Ask the kids, then decide - each child reports up, the parent combines, and a global variable keeps the best "bend" seen so far.Open the Tree DFS guide →
- 162Binary Tree Preorder TraversalEasy
- 163Same TreeEasy
- 164Symmetric TreeEasy
- 165Binary Tree PathsEasy
- 166Convert Sorted Array to Binary Search TreeEasy
- 167Count Complete Tree NodesEasy
- 168Binary Tree Postorder TraversalEasy
- 169Invert Binary TreeEasy
- 170Diameter of Binary TreeEasy
- 171Path Sum IIIMedium
- 172Maximum Difference Between Node and AncestorMedium
- 173Construct Binary Tree from Preorder and Inorder TraversalMedium
- 174Construct Binary Tree from Inorder and Postorder TraversalMedium
- 175Delete Nodes And Return ForestMedium
- 176Lowest Common Ancestor of a Binary TreeMedium
- 177Find Duplicate SubtreesMedium
- 178Flatten Binary Tree to Linked ListMedium
- 179Distribute Coins in Binary TreeMedium
- 180Serialize and Deserialize Binary TreeHard
- 181Binary Tree Maximum Path SumHard
25Binary Search Tree & In-order
6
Instinct The tree is a BST? Its in-order walk is a sorted list and every node splits the search space - think "sorted array in tree form", not "visit everything".Memory hack Left is less, right is more, in-order reads the sorted score - and every node lives inside a (low, high) fence set by its ancestors.Open the Binary Search Tree & In-order guide →
26Ordered Set (TreeMap)
4
Instinct Keys keep arriving or leaving and you must ask "what is the nearest key below/above x?" or "current min/max" each time - reach for TreeMap/TreeSet.Memory hack A HashMap with a sense of direction - floor looks down, ceiling looks up, and both answer in log time while the data keeps changing.Open the Ordered Set (TreeMap) guide →
27Trie
6
Instinct Many words, shared prefixes, and questions like "starts with", autocomplete, wildcard match or "search a board for all these words" - build a prefix tree.Memory hack Words share their beginnings, so store each beginning once - walk one letter per step, and an end flag marks where a real word stops.Open the Trie guide →
28Heap & Top-K
6
Instinct "K largest / smallest / closest / most frequent", or "always take the best available next"? Keep a heap - size k for top-K, or a ready-queue for scheduling.Memory hack Guard the top-K club with a bouncer - a min-heap of size k whose root is the weakest member; anyone stronger kicks them out.Open the Heap & Top-K guide →
29Two Heaps
3
Instinct When you need the middle of a changing collection, or best-of-one-pile fed by another pile, split it into a max-heap low half and a min-heap high half.Memory hack Small fries in a max-heap, big fish in a min-heap; the median lives on the shoreline between them.Open the Two Heaps guide →
30K-Way Merge
4
Instinct Several sorted lists, rows or streams and you need the global order, the k-th smallest or a range: keep one cursor per list in a min-heap.Memory hack Line up the heads, crown the smallest, then let its next-in-line step up.Open the K-Way Merge guide →
31Fenwick & Segment Tree
2
Instinct Range sums, mins or counts asked again and again while values keep changing: prefix sums break, so reach for a Fenwick or segment tree.Memory hack Prefix sums freeze, trees breathe: climb by the last set bit (i & -i) for Fenwick, split in halves for segment trees.Open the Fenwick & Segment Tree guide →
32Graph DFS
10
Instinct Connected regions, all paths, reachability, cloning or 2-colouring a graph or grid: dive from a node, mark it, recurse into unvisited neighbours.Memory hack Mark before you march: go deep, paint as you go, and back up only when every door is already painted.Open the Graph DFS guide →
- 213Number of IslandsMedium
- 214Time Needed to Inform All EmployeesMedium
- 215All Paths From Source to TargetMedium
- 216Clone GraphMedium
- 217Is Graph Bipartite?Medium
- 218All Nodes Distance K in Binary TreeMedium
- 219Employee ImportanceMedium
- 220Surrounded RegionsMedium
- 221Pacific Atlantic Water FlowMedium
- 222Making A Large IslandHard
33Graph BFS
6
Instinct Minimum moves, fewest steps or shortest transformation where every step costs the same: spread outward level by level with a queue.Memory hack Ripples in a pond: every ring is one step farther, so the first ring that touches the target is the answer.Open the Graph BFS guide →
34Topological Sort
4
Instinct Tasks with prerequisites, "X must come before Y", or an order hidden in comparisons: build a directed graph and peel off nodes with zero in-degree.Memory hack No prereqs? Off you go. Each finished task frees its followers; if someone is never freed, there is a cycle.Open the Topological Sort guide →
35Union-Find
4
Instinct Items get grouped by "connected", "same as" or "shares a" links and you keep asking which group something is in: merge sets with Union-Find.Memory hack Find your boss, merge the bosses; squash the chain (path compression) and hang the short tree under the tall one (rank).Open the Union-Find guide →
36Shortest Paths
5
Instinct Weighted edges plus "minimum cost, time or effort to reach" - grab a min-heap and always expand the cheapest unsettled node next (Dijkstra).Memory hack Pop the cheapest, skip the stale, relax the rest - Dijkstra is a ripple in a pond that touches near shores before far ones.Open the Shortest Paths guide →
37MST & Euler Paths
3
Instinct "Connect every point for the least total cost" means a minimum spanning tree; "use every edge or ticket exactly once" means an Euler path.Memory hack MST - grab the cheapest bridge that joins two separate islands. Euler - wander until stuck, write the stop down on the way back, then reverse.Open the MST & Euler Paths guide →
381-D Dynamic Programming
4
Instinct The best answer at position i depends only on a few earlier positions (i-1, i-2, ...) - write dp[i] from its predecessors, then roll it into variables.Memory hack Look back, pick best, roll forward - every step only remembers the last couple of stairs it stood on.Open the 1-D Dynamic Programming guide →
39Knapsack DP
6
Instinct Choose items to hit or stay under a target sum (can it be done, best value, fewest items, how many ways) - index a DP array by the remaining capacity.Memory hack Once? Walk back. Many? Walk forward. Each item used at most once loops capacity downward; reusable items loop it upward.Open the Knapsack DP guide →
40Longest Increasing Subsequence
3
Instinct Longest chain where each pick must beat the last (bigger, later, fits inside) - O(n²) best-ending-here DP, or O(n log n) tails plus binary search.Memory hack Patience solitaire - drop each card on the leftmost pile whose top is not smaller; the number of piles is the LIS length.Open the Longest Increasing Subsequence guide →
41Grid DP
9
Instinct Grid moves that never loop back (right/down, row to row) plus "count or optimise the paths" - build dp[r][c] from the cells that can step in.Memory hack Every cell asks its parents - a cell's answer comes only from the neighbours that can move into it, so fill cells in the order they arrive.Open the Grid DP guide →
42String DP
9
Instinct Two strings compared char by char (match, edit, interleave) means dp[i][j] over prefixes; one string's palindromes or splits means dp[l][r] or dp[i].Memory hack Match? Go diagonal. Mismatch? Ask the neighbours. Up drops a char from s, left drops one from t, diagonal uses both.Open the String DP guide →
43Tree & Graph DP
5
Instinct A node's best answer depends only on its children's answers - post-order DFS that returns a tiny tuple of states per node.Memory hack Kids report up, parent decides - every subtree hands its parent a small report card, and the parent never re-reads the kids' homework.Open the Tree & Graph DP guide →
44State Machine DP
2
Instinct Each step you are in one of a few modes (holding, sold, cooling down) with rules for switching - keep one DP value per mode and update all of them every step.Memory hack Name the moods, draw the moves, max the arrows - every arrow in your state diagram becomes exactly one line of code.Open the State Machine DP guide →
45Bitmask DP
3
Instinct n is tiny (about 20 or less) and you must use, visit or assign every item - make the set of used items a bitmask and DP over all 2^n subsets.Memory hack Small n, big choice - let the bits keep score: each item is a light switch and the mask is the whole switch panel.Open the Bitmask DP guide →
46Digit DP
3
Instinct Count numbers in [L, R] (R up to 10^9 or 10^18) whose digits obey a rule - build the number digit by digit with a "still tight to N" flag.Memory hack Walk the digits on a leash - stay tight to N or break free, and once free you never go back. Remember PTLS - Position, Tight, Leading zero, State.Open the Digit DP guide →
47Probability DP
3
Instinct Asked for a probability or expected value after random moves? Run DP over (step, state) and split each state's mass across every outcome.Memory hack Pour the probability like water - split it across the moves, let what spills off the board drain away, and the puddle that's left is your answer.Open the Probability DP guide →
48Math & Geometry
6
Instinct Digits, factors, slopes or distances hide a formula - find the invariant, then guard against overflow, negatives and floating-point error.Memory hack Mod peels, gcd reduces, squares compare - and long saves the day. Peel digits with %10, reduce slopes with gcd, compare squared distances.Open the Math & Geometry guide →
49String Matching
3
Instinct Find a pattern in a text, or a prefix that is also a suffix, faster than O(n·m) - reach for the KMP prefix function or a rolling hash.Memory hack KMP remembers borders, Rabin-Karp compares fingerprints - neither one re-reads text it has already seen.Open the String Matching guide →
No problems match these filters.
How to use this track
Pattern Wise 300 is the complete set: every major pattern with enough problems to master its variations, including harder dynamic programming, graph and design problems that appear in senior interviews.
Treat it as a three-month plan or longer. Start each pattern with its guide, solve the easy and medium problems first, and only then attempt the hard ones. Write down the key insight for each hard problem in your notes.
If you have already finished Pattern Wise 150, filter this track to unsolved problems and focus on the patterns where your solve rate is lowest.