LeetCode
LeetCode Patterns: Greedy Algorithms
When does picking the locally best option give the global optimum? A working tour of greedy algorithms with proofs (exchange argument), classic problems (Jump Game, Gas Station, Interval Scheduling, Task Scheduler, …
LeetCode Patterns: Stack and Queue
Master stack and queue applications: valid parentheses, monotonic stack for next greater element, BFS with queues, priority queues for top-K problems, and deque for sliding window maximum.
LeetCode Patterns: Backtracking Algorithms
Master the universal backtracking template through six classic problems: Permutations, Combinations, Subsets, Word Search, N-Queens, and Sudoku Solver. Learn the choose -> recurse -> un-choose pattern and the pruning …
LeetCode Patterns: Dynamic Programming Basics
Master dynamic programming through a single recipe: define the state, write the transition, anchor the base case. Worked solutions for Climbing Stairs, House Robber, Coin Change, LIS, 0/1 Knapsack, LCS, and Edit …
LeetCode Patterns: Binary Tree Traversal and Construction
A unified mental model for binary trees: how the four traversal orders are really one DFS recipe, why recursion and an explicit stack are the same algorithm, and how to reconstruct a tree from preorder + inorder. …
LeetCode Patterns: Binary Search
A working coder's guide to binary search: three templates, rotated arrays, peak finding, and binary search on the answer with worked traces and figures.
LeetCode Patterns: Sliding Window Technique
Master fixed-size and variable-size sliding window patterns. Solve Maximum Sum Subarray, Longest Substring Without Repeating Characters, Minimum Window Substring, and Permutation in String.
LeetCode Patterns: Linked List Operations
A complete linked list toolkit: reversal (iterative and recursive), merging sorted lists, Floyd's cycle detection, removing the nth node from end, and an LRU cache built on a doubly linked list plus hash map.
LeetCode Patterns: Two Pointers
A deep tour of the two-pointer family: collision, fast/slow, sliding window, and partition pointers. Five problems (Two Sum II, 3Sum, Container With Most Water, Linked List Cycle, Move Zeroes) explained with invariants, …
LeetCode Patterns: Hash Tables
Master hash table patterns through four classic LeetCode problems — Two Sum, Group Anagrams, Longest Substring Without Repeating Characters, and Top K Frequent Elements. Learn complement search, canonical-form grouping, …