75 data structures & algorithms problems, grouped by the pattern they teach and ordered from foundational to advanced: arrays and hashing through two pointers, sliding window, stacks, binary search, linked lists, trees, tries, heaps, backtracking, graphs, dynamic programming, and greedy. Free to read, no signup required.
How to use this: work down the list in order. Each problem lists its difficulty and a one-line hint toward the technique, not the full solution. Attempt a problem before reading its hint, and revisit a category once the pattern clicks rather than grinding every problem in one sitting.
01
The base layer of almost every interview. A hash map turns most "have I seen this before" or "what pairs up to a target" questions from O(n squared) into O(n).
Two Sum: Easy. Hash map of value to index, one pass.
Contains Duplicate: Easy. Hash set, return true on a repeat.
Group Anagrams: Medium. Sorted string (or letter count tuple) as the map key.
Top K Frequent Elements: Medium. Frequency map plus a heap or bucket sort.
Product of Array Except Self: Medium. Prefix products from the left, suffix products from the right, no division.
Valid Sudoku: Medium. Hash sets per row, column, and 3x3 box.
Longest Consecutive Sequence: Medium. Hash set, only start counting from a number with no left neighbor.
Hash mapHash setPrefix sums
02
Two indices moving toward or away from each other on sorted data, avoiding a nested loop.
Valid Palindrome: Easy. Pointers from both ends, skip non-alphanumeric.
Two Sum II - Input Array Is Sorted: Medium. Move the low pointer up or the high pointer down based on the sum.
3Sum: Medium. Sort, fix one number, two-pointer the rest, skip duplicates.
Container With Most Water: Medium. Always move the pointer at the shorter line inward.
Trapping Rain Water: Hard. Track the running max height from each side as the pointers close in.
Two pointersSorted array
03
A window that expands and shrinks over a contiguous range, tracking a running condition as it moves.
Best Time to Buy and Sell Stock: Easy. Track the minimum seen so far and the best profit against it.
Longest Substring Without Repeating Characters: Medium. Shrink the window from the left whenever a character repeats.
Longest Repeating Character Replacement: Medium. Window valid while (window length minus most-frequent-char count) is at most k.
Permutation in String: Medium. Fixed-size window, compare character counts.
Minimum Window Substring: Hard. Expand until valid, then shrink from the left to find the smallest valid window.
Sliding windowTwo pointers
04
Last-in-first-out order fits matching, undo, and "next greater element" style problems cleanly.
Valid Parentheses: Easy. Push opens, pop and match on closes.
Min Stack: Medium. A second stack tracking the running minimum.
Evaluate Reverse Polish Notation: Medium. Push numbers, pop two and apply the operator on each operator token.
Generate Parentheses: Medium. Backtrack, only add a close when opens exceed closes.
Daily Temperatures: Medium. Monotonic decreasing stack of indices, pop when a warmer day appears.
StackMonotonic stack
05
Halving a sorted (or monotonic) search space every step, not only on plain sorted arrays.
Binary Search: Easy. Classic low/high/mid loop on a sorted array.
Search a 2D Matrix: Medium. Treat the grid as one flattened sorted array.
Koko Eating Bananas: Medium. Binary search the eating speed, not the array.
Find Minimum in Rotated Sorted Array: Medium. Compare mid against the right end to tell which half is sorted.
Search in Rotated Sorted Array: Medium. Identify the sorted half first, then decide which half to search.
Binary searchSearch on answer
06
Pointer manipulation without an index. Draw the nodes on paper before touching code.
Reverse Linked List: Easy. Track previous, current, and next while flipping pointers.
Merge Two Sorted Lists: Easy. Dummy head, attach the smaller current node each step.
Reorder List: Medium. Find the middle, reverse the second half, then interleave the two halves.
Remove Nth Node From End of List: Medium. Two pointers n apart, move both until the lead hits the end.
Copy List with Random Pointer: Medium. Hash map from original node to its copy, then wire up next and random.
Linked List Cycle: Easy. Floyd's slow and fast pointers.
LRU Cache: Medium. Doubly linked list plus a hash map of key to node.
Linked listFast & slow pointersDummy node
07
Recursion is the default tool. Most tree problems fall out of a clean base case plus a recursive case.
Invert Binary Tree: Easy. Swap left and right at every node, recursively.
Maximum Depth of Binary Tree: Easy. 1 plus the larger of the two subtree depths.
Diameter of Binary Tree: Easy. At each node, track left depth plus right depth as a candidate answer.
Balanced Binary Tree: Easy. Return -1 up the recursion the moment a subtree is unbalanced.
Same Tree: Easy. Recursively compare values and both children.
Subtree of Another Tree: Easy. Same Tree check run at every node of the larger tree.
Binary Tree Level Order Traversal: Medium. BFS with a queue, processing one full level per loop iteration.
Validate Binary Search Tree: Medium. Carry a valid (low, high) range down the recursion.
Kth Smallest Element in a BST: Medium. Inorder traversal visits BST values in sorted order.
Lowest Common Ancestor of a Binary Search Tree: Medium. Go left or right based on where both target values fall relative to the current node.
RecursionDFSBFSBST property
08
A tree built for prefixes. Reach for it whenever a problem is about searching by string prefix.
Implement Trie (Prefix Tree): Medium. Each node holds child links per character and an end-of-word flag.
Design Add and Search Words Data Structure: Medium. Trie plus DFS branching at wildcard characters.
Word Search II: Hard. Build a trie of the words, then DFS the grid, pruning branches the trie rules out.
TriePrefix search
09
Whenever a problem only cares about the k smallest or largest values, a heap beats a full sort.
Kth Largest Element in a Stream: Easy. Min-heap capped at size k; the root is the answer.
Last Stone Weight: Easy. Max-heap, repeatedly pop the two heaviest and push the difference.
K Closest Points to Origin: Medium. Max-heap of size k keyed by distance.
Kth Largest Element in an Array: Medium. Min-heap of size k, or quickselect for average O(n).
Task Scheduler: Medium. Max-heap by frequency, filling cooldown slots greedily.
HeapPriority queueQuickselect
10
Explore a choice, recurse, undo the choice. The template barely changes between problems.
Subsets: Medium. At each element, branch into include and exclude.
Combination Sum: Medium. Branch on each candidate, allow reuse, prune once the running sum passes the target.
Permutations: Medium. Swap-based backtracking or a used-elements set.
Word Search: Medium. DFS from every cell, mark visited, backtrack the mark on the way out.
Palindrome Partitioning: Medium. Branch on every prefix that is itself a palindrome.
BacktrackingDFSRecursion tree
11
BFS for shortest paths on unweighted graphs, DFS for reachability, connectivity, and cycle checks.
Number of Islands: Medium. DFS or BFS flood fill from every unvisited land cell.
Clone Graph: Medium. DFS or BFS with a hash map from original node to its clone.
Pacific Atlantic Water Flow: Medium. DFS inward from each ocean's border cells, then intersect the two reachable sets.
Course Schedule: Medium. Cycle detection on a directed graph, prerequisite as an edge.
Number of Connected Components in an Undirected Graph: Medium. Union-find, or DFS from every unvisited node, counting components.
Graph Valid Tree: Medium. A valid tree needs exactly n-1 edges and no cycle, check both.
Word Ladder: Hard. BFS over words, an edge exists between words one letter apart.
BFSDFSUnion-findTopological order
12
Build the answer for position i from the answers to smaller positions, usually i-1 and i-2.
Climbing Stairs: Easy. ways(i) = ways(i-1) + ways(i-2), same shape as Fibonacci.
House Robber: Medium. At each house, take the better of skip it or rob it plus i-2.
House Robber II: Medium. Run House Robber twice, once excluding the first house and once excluding the last.
Longest Palindromic Substring: Medium. Expand outward from every center (odd and even length).
Decode Ways: Medium. At each digit, add ways using one digit and, if valid, ways using two digits.
Coin Change: Medium. Bottom-up table of minimum coins for every amount up to the target.
Longest Increasing Subsequence: Medium. O(n squared) table, or O(n log n) with a patience-sorting array.
1-D DPMemoizationTabulation
13
Make the locally best choice at each step and prove (or trust) it leads to a globally best answer.
Maximum Subarray: Medium. Kadane's algorithm: reset the running sum to zero whenever it goes negative.
Jump Game: Medium. Track the furthest reachable index while scanning left to right.
Merge Intervals: Medium. Sort by start time, merge whenever the next interval overlaps the last one kept.
GreedyIntervals
Frequently asked questions
Is 75 problems actually enough to prepare for interviews?
For most mid-level interviews, yes, if you genuinely understand the pattern behind each problem rather than memorizing the solution. These 75 cover every pattern that shows up repeatedly across real interviews; a much longer list mostly adds more of the same pattern rather than new ones.
What order should I solve these in?
Top to bottom. The categories are ordered from foundational (arrays, two pointers) to more advanced (graphs, dynamic programming), and later categories lean on comfort with earlier ones, especially recursion for trees, backtracking, and DP.
Should I read the hint before attempting a problem?
Try the problem cold for at least fifteen to twenty minutes first. The hint here is a nudge toward the pattern, not a full solution, and struggling productively before checking it is what actually builds the skill.
Do I need to solve every problem in a category before moving on?
No. If a pattern clicks after three or four problems, move to the next category and come back later. Revisiting a category after a break, once you have more pattern recognition, is often more useful than grinding it in one sitting.
What if I can't solve a problem at all?
Read an editorial or explanation, understand the approach fully, then close it and re-solve it from scratch a day or two later without looking. Copying a solution without re-deriving it later rarely sticks.
How does this list relate to Interview Ready on Careermaxxing?
This is a free, general-purpose practice list. Interview Ready builds a personalized 30-day plan around your resume and a specific target role, sequencing DSA practice with system design and behavioural prep in the right order for that role.
Want these sequenced into a full interview plan?
This list is the practice set. Interview Ready turns it into a personalized 30-day plan built around your resume and a specific target role: DSA in the right order, plus system design and behavioural prep, with a guided Build-a-Project track alongside it. Start free.