Problem Collection · LeetCode and Interview Practice
Technique-matched problems for each week of Advanced Algorithmic Problem Solving
Each weekly set contains interview-style problems selected because they exercise the technique taught that week. Start with the first two problems for pattern recognition, then use the remaining problems for transfer, proof practice, and implementation discipline. The notes identify what to look for while solving.
| Problem | Technique focus | Why it fits |
|---|---|---|
| Two Sum | hashing and constraint-based improvement | Shows the move from quadratic search to a linear hash-table model. |
| Valid Anagram | counting invariant | Turns a text problem into a frequency-vector equality check. |
| Merge Intervals | sorting plus invariant | Requires precise modelling of overlap and a clean loop invariant. |
| Container With Most Water | two pointers | Good interview example for explaining why one pointer can be discarded. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Subsets | binary choice recursion | Canonical state-space tree with clear output-size complexity. |
| Permutations | visited-set backtracking | Highlights recursion state, used elements, and factorial complexity. |
| Combination Sum | pruned enumeration | Uses monotone choices to avoid duplicate combinations. |
| N-Queens | constraint propagation | Classic pruning problem using columns and diagonal occupancy sets. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Climbing Stairs | one-dimensional recurrence | Minimal example for state, base case, transition, and space compression. |
| House Robber | choice DP | Forces students to encode mutually exclusive local choices. |
| Unique Paths | grid DP | Clean two-dimensional tabulation with combinatorial interpretation. |
| Coin Change | unbounded knapsack | Introduces unreachable states and minimization over transitions. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Longest Increasing Subsequence | DP and binary-search optimization | Good contrast between O(n squared) DP and O(n log n) patience sorting. |
| Longest Common Subsequence | two-sequence DP | Canonical table recurrence with reconstruction discussion. |
| Partition Equal Subset Sum | pseudo-polynomial DP | Connects subset-sum modelling to complexity and constraints. |
| Burst Balloons | interval DP | Requires choosing the final action in an interval, a useful advanced pattern. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Jump Game | greedy reachability | Short problem with a strong invariant about farthest reachable index. |
| Non-overlapping Intervals | interval scheduling | Direct practice for earliest-finish-time exchange reasoning. |
| Task Scheduler | greedy counting | Shows how frequency constraints become a schedule-length formula. |
| Minimum Number of Arrows to Burst Balloons | interval stabbing | Nice variant for proving why sorting by right endpoint works. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Koko Eating Bananas | binary search on answer | Classic monotone feasibility predicate with integer boundary care. |
| Search in Rotated Sorted Array | modified binary search | Forces invariant design when the sorted half changes by case. |
| Count of Smaller Numbers After Self | divide and conquer counting | Merge-sort counting problem that connects recursion to order statistics. |
| Median of Two Sorted Arrays | partition search | Advanced interview problem for precise binary-search proof. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Range Sum Query: Mutable | Fenwick tree or segment tree | Direct match for point updates and range queries. |
| Sliding Window Maximum | monotonic deque | Shows how a deque maintains candidates and gives amortized O(n). |
| Daily Temperatures | monotonic stack | Simple and effective for next-greater-element reasoning. |
| Accounts Merge | union-find | Models equivalence classes and component extraction through DSU. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Course Schedule | directed graph and topological order | Turns prerequisites into cycle detection and ordering. |
| Rotting Oranges | multi-source BFS | Good grid problem for levels, time, and queue invariants. |
| Pacific Atlantic Water Flow | reverse graph traversal | Shows how reversing the search direction simplifies reachability. |
| Word Ladder | implicit graph BFS | Interview staple for modelling words as graph vertices without materializing all edges. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Network Delay Time | Dijkstra | Direct weighted shortest-path application with adjacency-list design. |
| Cheapest Flights Within K Stops | bounded Bellman-Ford | Illustrates why a stop limit changes the shortest-path state. |
| Critical Connections in a Network | bridges and low-link values | Prepares students for SCC-style DFS timestamps and structural graph analysis. |
| Min Cost to Connect All Points | minimum spanning tree | Clean MST problem where Prim or Kruskal can be justified. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Implement Trie | prefix tree | Direct implementation of dictionary operations and prefix queries. |
| Find All Anagrams in a String | sliding window counts | Connects string matching to frequency invariants. |
| Repeated DNA Sequences | rolling hash and encoding | Compact example for fixed-length string hashing. |
| Longest Duplicate Substring | binary search plus hashing | Combines answer search, suffix intuition, and collision discussion. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| Partition to K Equal Sum Subsets | NP-hard style search with pruning | Shows why exponential backtracking remains necessary under small constraints. |
| Sudoku Solver | constraint search | Practical exact search with strong pruning and constraint propagation. |
| Shortest Path Visiting All Nodes | state compression BFS | Uses exponential state space with polynomial graph traversal over states. |
| Word Ladder II | BFS plus path enumeration | Demonstrates output-sensitive complexity and why all shortest paths can be large. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| LRU Cache | hash map plus linked list design | High-signal interview problem for data-structure design and invariants. |
| Merge k Sorted Lists | heap and divide and conquer | Allows multiple valid approaches and complexity comparison. |
| Serialize and Deserialize Binary Tree | tree traversal protocol | Tests representation choices, edge cases, and clear explanation. |
| Trapping Rain Water | two pointers or monotonic stack | Good simulation problem for explaining alternative approaches. |
| Problem | Technique focus | Why it fits |
|---|---|---|
| The Skyline Problem | sweep line and heap | Contest-style combination of events, ordering, and active-set maintenance. |
| Swim in Rising Water | Dijkstra or binary search plus BFS | Good final review problem with multiple defensible algorithmic routes. |
| Minimum Cost to Make at Least One Valid Path in a Grid | 0-1 BFS | Introduces a contest-grade shortest-path variant with binary edge costs. |
| Word Ladder II | graph search and reconstruction | Useful capstone for modelling, BFS levels, predecessor graphs, and output size. |