Similar-Problems Cross-Link Map
Auto-generated by
scripts/regenerate_similar_problems_map.py. Each row lists pattern, difficulty, similar-problem links (from## Similar Problems), and mind-map tags. Re-runscripts/refresh-knowledgebase.shafter adding or editing problem mind-maps. Canonical problem locations follow the Problem index.
| # | Problem | Pattern | Difficulty | Similar (excerpt) | Tags |
|---|---|---|---|---|---|
| 1192 | 1192. Critical Connections in a Network | Tarjan bridge finding (DFS lowlink) | Hard | 261:../../graphs/problems/261-graph-valid-tree.md; 684:../../graphs/problems/684-redundant-connection.md; 685:./685-redundant-connection-ii.md | #tarjan #bridge #lowlink #dfs #undirected-graph #cut-edge |
| 1334 | 1334. Find the City With the Smallest Number of Neighbors at a Thresho | Floyd-Warshall / all-pairs shortest paths (APSP on small n) or repeated Dijkstra | Medium | 743:../../graphs/problems/743-network-delay-time.md; 787:../../graphs/problems/787-cheapest-flights-within-k-stops.md; 847:./847-shortest-path-visiting-all-nodes.md | #floyd-warshall #all-pairs-shortest-path #threshold-count #tie-break |
| 1631 | 1631. Path With Minimum Effort | Dijkstra minimax on grid + heap; alternative binary search + BFS | Hard | 778:../../graphs/problems/778-swim-in-rising-water.md; 743:../../graphs/problems/743-network-delay-time.md; 329:../../dp-2d/problems/329-longest-increasing-path-in-a-matrix.md | #dijkstra #minimax #grid #binary-search-on-answer #absolute-difference-edge |
| 685 | 685. Redundant Connection II | Union-Find + directed-tree case analysis | Hard | 684:../../graphs/problems/684-redundant-connection.md; 261:../../graphs/problems/261-graph-valid-tree.md; 1192:./1192-critical-connections.md | #union-find #directed-tree #two-parents #cycle-detection #case-analysis |
| 802 | 802. Find Eventual Safe States | Topological sort on reverse graph or DFS three-color cycle detection | Hard | 207:../../graphs/problems/207-course-schedule.md; 210:../../graphs/problems/210-course-schedule-ii.md; 685:./685-redundant-connection-ii.md | #reverse-topo #outdegree-peel #safe-states #directed-acyclic-condensation |
| 815 | 815. Bus Routes | BFS on compressed graph (routes as nodes) | Hard | 743:../../graphs/problems/743-network-delay-time.md; 994:../../graphs/problems/994-rotting-oranges.md; 847:./847-shortest-path-visiting-all-nodes.md | #bfs #route-compression #multi-source #stop-to-route-index #layered-bfs |
| 847 | 847. Shortest Path Visiting All Nodes | BFS on (visitedMask, lastNode) state graph — Traveling Salesman / Held–Karp bitmask | Hard | 994:../../graphs/problems/994-rotting-oranges.md; 815:./815-bus-routes.md; 329:../../dp-2d/problems/329-longest-increasing-path-in-a-matrix.md | #bfs #bitmask #tsp-walk #multi-source #state-space-shortest-path |
| 924 | 924. Minimize Malware Spread | Union-Find component analysis + counting / tie-breaking | Hard | 547:../../graphs/problems/547-number-of-provinces.md; 684:../../graphs/problems/684-redundant-connection.md; 1192:./1192-critical-connections.md | #union-find #component-count #malware #tie-break #greedy-on-components |
| 1 | 1. Two Sum | Hash Map Lookup | Easy | 167:../../two-pointers/problems/167-two-sum-ii.md; 242:./242-valid-anagram.md; 217:./217-contains-duplicate.md | #hashmap #arrays #two-sum #complement-lookup #indices |
| 26 | 26. Remove Duplicates from Sorted Array | Two Pointers | Easy | 027:./027-remove-element.md; 088:./088-merge-sorted-array.md; 283:../../two-pointers/problems/283-move-zeroes.md | #two-pointers #sorted #dedupe #in-place |
| 27 | 27. Remove Element | Two Pointers | Easy | 026:./026-remove-duplicates-from-sorted-array.md; 283:../../two-pointers/problems/283-move-zeroes.md; 088:./088-merge-sorted-array.md | #two-pointers #in-place #filter #arrays |
| 36 | 36. Valid Sudoku | Hash Set per Row/Col/Box | Medium | 128:./128-longest-consecutive-sequence.md; 217:./217-contains-duplicate.md; 048:./048-rotate-image.md | #matrix #hashset #sudoku #grid-indexing #validation |
| 48 | 48. Rotate Image | Transpose + reverse rows (90° clockwise) | Medium | 054:./054-spiral-matrix.md; 189:./189-rotate-array.md; 036:./036-valid-sudoku.md | #matrix #transpose #reverse #in-place #geometry |
| 49 | 49. Group Anagrams | Hash Map Bucketing | Medium | 242:./242-valid-anagram.md; 001:./001-two-sum.md; 217:./217-contains-duplicate.md | #hashmap #strings #anagram #bucketing #canonical-key |
| 53 | 53. Maximum Subarray | Kadane (DP-1D) | Medium | 152:../../dp-1d/problems/152-maximum-product-subarray.md; 121:./121-best-time-to-buy-sell-stock.md; 238:./238-product-of-array-except-self.md | #kadane #dp #subarray #prefix-state #greedy-choice |
| 54 | 54. Spiral Matrix | Layered traversal | Medium | 048:./048-rotate-image.md; 036:./036-valid-sudoku.md; 189:./189-rotate-array.md | #matrix #spiral #layer #boundaries #simulation |
| 88 | 88. Merge Sorted Array | Two Pointers (in-place, fill from end) | Easy | 026:./026-remove-duplicates-from-sorted-array.md; 167:../../two-pointers/problems/167-two-sum-ii.md; 21:../../linked-list/problems/021-merge-two-sorted-lists.md | #two-pointers #merge #in-place #sorted #arrays |
| 121 | 121. Best Time to Buy and Sell Stock | One pass minimum (single transaction) | Easy | 122:./122-best-time-to-buy-sell-stock-ii.md; 053:./053-maximum-subarray.md; 189:./189-rotate-array.md | #arrays #greedy #min-so-far #profit #one-pass |
| 122 | 122. Best Time to Buy and Sell Stock II | Greedy (accumulate positive daily deltas) | Medium | 121:./121-best-time-to-buy-sell-stock.md; 053:./053-maximum-subarray.md; 189:./189-rotate-array.md | #greedy #arrays #stock #adjacent-delta #accumulation |
| 128 | 128. Longest Consecutive Sequence | Hash Set Sequence | Medium | 217:./217-contains-duplicate.md; 001:./001-two-sum.md; 049:./049-group-anagrams.md | #hashset #sequence #on-time #integers #chain-start |
| 169 | 169. Majority Element | Boyer–Moore voting | Easy | 053:./053-maximum-subarray.md; 217:./217-contains-duplicate.md; 001:./001-two-sum.md | #boyer-moore #majority #linear #constant-space #voting |
| 189 | 189. Rotate Array | Reverse trick (triple reverse) | Medium | 048:./048-rotate-image.md; 054:./054-spiral-matrix.md; 088:./088-merge-sorted-array.md | #arrays #reverse #in-place #rotation #modular-index |
| 217 | 217. Contains Duplicate | Hash Set | Easy | 001:./001-two-sum.md; 128:./128-longest-consecutive-sequence.md; 242:./242-valid-anagram.md | #hashset #arrays #duplicate-detection #membership |
| 238 | 238. Product of Array Except Self | Prefix Sum / Suffix (prefix–suffix products) | Medium | 152:../../dp-1d/problems/152-maximum-product-subarray.md; 053:./053-maximum-subarray.md; 121:./121-best-time-to-buy-sell-stock.md | #arrays #prefix-sum #suffix #product #linear |
| 242 | 242. Valid Anagram | Hash Map Counting | Easy | 049:./049-group-anagrams.md; 217:./217-contains-duplicate.md; 001:./001-two-sum.md | #hashmap #strings #anagram #frequency #counting |
| 271 | 271. Encode and Decode Strings | String Encoding | Medium | 238:./238-product-of-array-except-self.md; 242:./242-valid-anagram.md; 394:../../stack/problems/394-decode-string.md | #strings #encoding #length-prefix #serialization #design |
| 347 | 347. Top K Frequent Elements | Top-K / Heap (bucket sort variant) | Medium | 215:../../heap-priority-queue/problems/215-kth-largest-element-in-array.md; 238:./238-product-of-array-except-self.md; 001:./001-two-sum.md | #heap #bucket-sort #frequency #hashmap #top-k |
| 17 | 17. Letter Combinations of a Phone Number | DFS / Backtracking | Medium | 46:./046-permutations.md; 78:./078-subsets.md | #backtracking #string #cartesian #phone #dfs |
| 39 | 39. Combination Sum | DFS / Backtracking | Medium | 40:./040-combination-sum-ii.md; 78:./078-subsets.md; 322:../../dp-1d/problems/322-coin-change.md | #backtracking #combination #dfs #reuse-allowed #sorted-start-index |
| 40 | 40. Combination Sum II | DFS / Backtracking | Medium | 39:./039-combination-sum.md; 90:./090-subsets-ii.md | #backtracking #dedupe #sort #combination #target-sum |
| 46 | 46. Permutations | DFS / Backtracking | Medium | 78:./078-subsets.md; 79:./079-word-search.md; 90:./090-subsets-ii.md | #backtracking #permutation #visited-array #factorial-output |
| 051 | 051. N-Queens | DFS / Backtracking (also bit-pruning variant: Bit Manipulation) | Hard | 46:./046-permutations.md; 79:./079-word-search.md; 36:../../arrays-hashing/problems/036-valid-sudoku.md | #backtracking #chess #diagonals #constraint-pruning #bitmasks-optional #exhaustive-search |
| 78 | 78. Subsets | DFS / Backtracking | Medium | 90:./090-subsets-ii.md; 46:./046-permutations.md | #backtracking #subsets #power-set #dfs #recursion |
| 79 | 79. Word Search | DFS / Backtracking | Medium | 46:./046-permutations.md; 131:./131-palindrome-partitioning.md | #dfs #grid #backtracking #path #string |
| 90 | 90. Subsets II | DFS / Backtracking | Medium | 78:./078-subsets.md; 40:./040-combination-sum-ii.md | #backtracking #subsets #dedupe #sort #dfs |
| 131 | 131. Palindrome Partitioning | DFS / Backtracking | Medium | 39:./039-combination-sum.md; 079:./079-word-search.md | #backtracking #palindrome #string #partition #dfs |
| 698 | 698. Partition to K Equal Sum Subsets | DFS / Backtracking | Medium | 39:./039-combination-sum.md; 40:./040-combination-sum-ii.md; 416:../../dp-1d/problems/416-partition-equal-subset-sum.md | #backtracking #bucket-fill #pruning #sort-desc #bitmask-optional |
| 004 | 004. Median of Two Sorted Arrays | Binary Search (partition the two arrays) | Hard | 704:./704-binary-search.md; 35:./035-search-insert-position.md; 410:./410-split-array-largest-sum.md | #binary-search #partition #median #two-arrays #log-min #sentinel |
| 33 | 33. Search in Rotated Sorted Array | Binary Search (Rotated, two ascents) | Medium | 153:./153-find-min-in-rotated-sorted-array.md; 704:./704-binary-search.md; 35:./035-search-insert-position.md | #binary-search #rotated-array #sorted-half-invariant #target-range |
| 35 | 35. Search Insert Position | Binary Search (Lower bound) | Easy | 704:./704-binary-search.md; 74:./074-search-a-2d-matrix.md; 33:./033-search-in-rotated-sorted-array.md | #binary-search #lower-bound #sorted-array #half-open-interval |
| 74 | 74. Search a 2D Matrix | Binary Search (Implicit 1D order) | Medium | 704:./704-binary-search.md; 35:./035-search-insert-position.md; 875:./875-koko-eating-bananas.md | #binary-search #matrix #row-major #implicit-sorted-array |
| 1011 | 1011. Capacity to Ship Packages Within D Days | Binary Search (Search on answer) | Medium | 875:./875-koko-eating-bananas.md; 704:./704-binary-search.md; 35:./035-search-insert-position.md | #binary-search #search-on-answer #greedy-feasibility #partition-days |
| 153 | 153. Find Minimum in Rotated Sorted Array | Binary Search (Rotation / pivot) | Medium | 33:./033-search-in-rotated-sorted-array.md; 162:./162-find-peak-element.md; 704:./704-binary-search.md | #binary-search #rotated-array #pivot #compare-to-right |
| 162 | 162. Find Peak Element | Binary Search (Slope / neighbor compare) | Medium | 153:./153-find-min-in-rotated-sorted-array.md; 704:./704-binary-search.md; 875:./875-koko-eating-bananas.md | #binary-search #peak #slope #neighbor-compare |
| 410 | 410. Split Array Largest Sum | Binary Search on answer (feasibility check) | Hard | 1011:./1011-capacity-to-ship-packages-in-d-days.md; 875:./875-koko-eating-bananas.md; 4:./004-median-of-two-sorted-arrays.md | #binary-search-on-answer #minimize-maximum #greedy-feasibility #contiguous-split #hard-classic |
| 540 | 540. Single Element in a Sorted Array | Binary Search (Pair invariant) | Medium | 704:./704-binary-search.md; 136:../../bit-manipulation/problems/136-single-number.md; 153:./153-find-min-in-rotated-sorted-array.md | #binary-search #pairs #even-index-invariant #sorted-structure |
| 704 | 704. Binary Search | Binary Search (Vanilla) | Easy | 35:./035-search-insert-position.md; 74:./074-search-a-2d-matrix.md; 33:./033-search-in-rotated-sorted-array.md | #binary-search #sorted-array #log-n #two-end-window |
| 875 | 875. Koko Eating Bananas | Binary Search (Search on answer) | Medium | 1011:./1011-capacity-to-ship-packages-in-d-days.md; 704:./704-binary-search.md; 35:./035-search-insert-position.md | #binary-search #search-on-answer #monotone-feasible #ceil-sum |
| 981 | 981. Time Based Key-Value Store | Binary Search (Prefix / latest ≤ timestamp) | Medium | 35:./035-search-insert-position.md; 704:./704-binary-search.md; 875:./875-koko-eating-bananas.md | #binary-search #time-series #prefix-max #map-of-vectors |
| 136 | 136. Single Number | XOR cancelation (Bit Manipulation) | Easy | 268:./268-missing-number.md; 137:./137-single-number-ii.md | #xor #cancel-pairs #bit-manipulation #linear-scan |
| 137 | 137. Single Number II | Bit count modulo 3 (Bit Manipulation) | Medium | 136:./136-single-number.md; 268:./268-missing-number.md | #mod-3 #bits #finite-state #xor-generalization #single-number |
| 190 | 190. Reverse Bits | Bit ops / shift accumulate (Bit Manipulation) | Easy | 191:./191-number-of-1-bits.md; 007:../../math-geometry/problems/007-reverse-integer.md | #reverse-bits #shift #unsigned #fixed-width #bit-ops |
| 191 | 191. Number of 1 Bits | Brian Kernighan trick (Bit Manipulation) | Easy | 338:./338-counting-bits.md; 190:./190-reverse-bits.md | #popcount #brian-kernighan #lowest-set-bit #bit-tricks |
| 268 | 268. Missing Number | XOR / Gauss sum (Bit Manipulation) | Easy | 136:./136-single-number.md; 338:./338-counting-bits.md | #xor #missing-value #index-match #range-0-n #linear |
| 338 | 338. Counting Bits | DP + bit relation (Bit Manipulation) | Easy | 191:./191-number-of-1-bits.md; 268:./268-missing-number.md | #dp #popcount #bit-relation #prefix-table #on |
| 371 | 371. Sum of Two Integers | Bitwise full adder (Bit Manipulation) | Medium | 136:./136-single-number.md; 191:./191-number-of-1-bits.md | #full-adder #xor #carry #ripple #bit-manipulation |
| 5 | 5. Longest Palindromic Substring | Dynamic Programming and/or expand around center; Two Pointers for expand | Medium | 647:./647-palindromic-substrings.md; 1143:../../dp-2d/problems/1143-longest-common-subsequence.md; 091:./091-decode-ways.md | #dp-2d-on-string #palindrome #expand-center #medium |
| 32 | 32. Longest Valid Parentheses | Dynamic Programming + Monotonic Stack | Hard | 20:../../stack/problems/020-valid-parentheses.md; 22:../../stack/problems/022-generate-parentheses.md; 84:../../stack/problems/084-largest-rectangle-in-histogram.md | #parentheses #monotonic-stack #sentinel-index #o-n-one-pass #span-length |
| 70 | 70. Climbing Stairs | Dynamic Programming (Fibonacci-style linear recurrence) | Easy | 746:./746-min-cost-climbing-stairs.md; 198:./198-house-robber.md; 322:./322-coin-change.md | #dp-1d #linear-dp #fibonacci #rolling-state #easy |
| 91 | 91. Decode Ways | Dynamic Programming (string digit partition) | Medium | 139:./139-word-break.md; 322:./322-coin-change.md | #dp-1d #string-dp #digit-partition #rolling-state #medium |
| 132 | 132. Palindrome Partitioning II | Dynamic Programming — prefix min cuts + palindrome preprocessing | Hard | 131:../../backtracking/problems/131-palindrome-partitioning.md; 5:./005-longest-palindromic-substring.md; 32:./032-longest-valid-parentheses.md | #palindrome-dp #prefix-dp #minimum-cuts #interval-table #o-n-squared |
| 139 | 139. Word Break | Dynamic Programming on string segmentation; Trie for dictionary lookup / pruning | Medium | 091:./091-decode-ways.md; 322:./322-coin-change.md; 300:./300-longest-increasing-subsequence.md | #word-break #trie-optional #segmentation-dp #dictionary #medium |
| 152 | 152. Maximum Product Subarray | Dynamic Programming (track min and max along line) | Medium | 53:../../arrays-hashing/problems/053-maximum-subarray.md; 238:../../arrays-hashing/problems/238-product-of-array-except-self.md; 322:./322-coin-change.md | #kadane-variant #product #min-max-dp #dp-1d #medium |
| 198 | 198. House Robber | Dynamic Programming (take-or-skip on a line) | Medium | 213:./213-house-robber-ii.md; 746:./746-min-cost-climbing-stairs.md; 070:./070-climbing-stairs.md | #dp-1d #take-or-skip #linear-dp #rolling-state #medium |
| 213 | 213. House Robber II | Dynamic Programming (circular array reduction) | Medium | 198:./198-house-robber.md; 070:./070-climbing-stairs.md; 300:./300-longest-increasing-subsequence.md | #dp-1d #circular-array #house-robber #two-pass #medium |
| 300 | 300. Longest Increasing Subsequence | Dynamic Programming (O(n^2)); patience sorting + binary search (O(n log n)) | Medium | 322:./322-coin-change.md; 416:./416-partition-equal-subset-sum.md; 1143:../../dp-2d/problems/1143-longest-common-subsequence.md | #lis #patience-sorting #binary-search-on-answer #dp-1d #medium |
| 322 | 322. Coin Change | Dynamic Programming (unbounded knapsack: minimum count) | Medium | 518:../../dp-2d/problems/518-coin-change-2.md; 494:../../dp-2d/problems/494-target-sum.md | #unbounded-knapsack #coin-change #min-coins #dp-1d #medium |
| 416 | 416. Partition Equal Subset Sum | Dynamic Programming (0/1 knapsack reachability) | Medium | 494:../../dp-2d/problems/494-target-sum.md; 322:./322-coin-change.md | #01-knapsack #subset-sum #partition #boolean-dp #medium |
| 647 | 647. Palindromic Substrings | Dynamic Programming (string palindromes) / expand around center | Medium | 5:./005-longest-palindromic-substring.md; 091:./091-decode-ways.md; 300:./300-longest-increasing-subsequence.md | #palindrome #expand-center #string-dp #counting #medium |
| 746 | 746. Min Cost Climbing Stairs | Dynamic Programming (linear minimum cost) | Easy | 70:./070-climbing-stairs.md; 198:./198-house-robber.md | #dp-1d #linear-dp #min-cost-path #rolling-state #easy |
| 10 | 10. Regular Expression Matching | Dynamic Programming — string vs pattern (with * Kleene on prior atom) | Hard | 72:./072-edit-distance.md; 97:./097-interleaving-string.md; 115:./115-distinct-subsequences.md | #regex-dp #kleene-star #dot-wildcard #prefix-match #boolean-table |
| 62 | 62. Unique Paths | Dynamic Programming (grid paths) | Medium | 63:./063-unique-paths-ii.md; 1143:./1143-longest-common-subsequence.md; 097:./097-interleaving-string.md | #grid-dp #combinatorics #path-count #rolling-row #medium |
| 63 | 63. Unique Paths II | Dynamic Programming (grid with obstacles) | Medium | 62:./062-unique-paths.md; 322:../../dp-1d/problems/322-coin-change.md; 518:./518-coin-change-2.md | #grid-dp #obstacles #rolling-row #medium |
| 72 | 72. Edit Distance | Dynamic Programming — two strings | Hard | 1143:./1143-longest-common-subsequence.md; 97:./097-interleaving-string.md; 115:./115-distinct-subsequences.md | #levenshtein #two-string-dp #rolling-array #string-alignment #minimum-ops |
| 97 | 97. Interleaving String | Dynamic Programming (two-string matching with merge order) | Medium | 1143:./1143-longest-common-subsequence.md; 62:./062-unique-paths.md | #2d-dp #interleaving #two-strings #medium |
| 1143 | 1143. Longest Common Subsequence | Dynamic Programming (2D string/table LCS) | Medium | 300:../../dp-1d/problems/300-longest-increasing-subsequence.md; 097:./097-interleaving-string.md | #lcs #2d-dp #string-dp #rolling-two-rows #medium |
| 115 | 115. Distinct Subsequences | Dynamic Programming — two-sequence (count ways to match subsequence) | Hard | 1143:./1143-longest-common-subsequence.md; 72:./072-edit-distance.md; 10:./010-regular-expression-matching.md | #two-string-dp #subsequence-count #rolling-array #modulo #reverse-inner-loop |
| 174 | 174. Dungeon Game | Dynamic Programming — reverse reachability / min initial resource | Hard | 62:./062-unique-paths.md; 329:./329-longest-increasing-path-in-a-matrix.md; 312:./312-burst-balloons.md | #grid-dp #reverse-dp #min-initial-resource #survival #clamp-positive |
| 309 | 309. Best Time to Buy and Sell Stock with Cooldown | Dynamic Programming (finite state machine on timeline) | Medium | 121:../../arrays-hashing/problems/121-best-time-to-buy-sell-stock.md; 122:../../arrays-hashing/problems/122-best-time-to-buy-sell-stock-ii.md; 416:../../dp-1d/problems/416-partition-equal-subset-sum.m | #stock-dp #state-machine #cooldown #medium |
| 312 | 312. Burst Balloons | Interval DP (optimal subarray removal / matrix chain style) | Hard | 131:../../backtracking/problems/131-palindrome-partitioning.md; 1143:./1143-longest-common-subsequence.md; 887:./887-super-egg-drop.md | #interval-dp #last-element-split #matrix-chain #pad-sentinel #maximize-coins |
| 329 | 329. Longest Increasing Path in a Matrix | DFS + memoization on DAG (implicit graph from strict increase) + Dynamic Programming | Hard | 62:./062-unique-paths.md; 300:../../dp-1d/problems/300-longest-increasing-subsequence.md; 847:../../advanced-graphs/problems/847-shortest-path-visiting-all-nodes.md | #grid-dp #dag-longest-path #dfs-memo #strictly-increasing #implicit-graph |
| 494 | 494. Target Sum | Dynamic Programming (subset sum / knapsack reformulation) | Medium | 416:../../dp-1d/problems/416-partition-equal-subset-sum.md; 518:./518-coin-change-2.md | #subset-sum #sign-assignment #01-knapsack-count #medium |
| 518 | 518. Coin Change 2 | Dynamic Programming (unbounded knapsack: count ways) | Medium | 322:../../dp-1d/problems/322-coin-change.md; 494:./494-target-sum.md | #unbounded-knapsack #combinations #coin-change-2 #medium |
| 887 | 887. Super Egg Drop | Dynamic Programming + binary search on answer — egg-drop / DP over moves | Hard | 312:./312-burst-balloons.md; 410:../../binary-search/problems/410-split-array-largest-sum.md; 174:./174-dungeon-game.md | #egg-drop #minimax #dp-on-moves #reverse-state-count #binary-search-floor |
| 127 | 127. Word Ladder | BFS / shortest path on implicit graph | Hard | 994:./994-rotting-oranges.md; 200:./200-number-of-islands.md; 778:./778-swim-in-rising-water.md | #bfs #implicit-graph #shortest-path #string-transform #layered-search |
| 130 | 130. Surrounded Regions | DFS / Backtracking | Medium | 200:./200-number-of-islands.md; 417:./417-pacific-atlantic-water-flow.md | #grid #dfs #boundary #flood-fill #in-place |
| 133 | 133. Clone Graph | DFS / Backtracking + hash map | Medium | 200:./200-number-of-islands.md; 261:./261-graph-valid-tree.md; 138:../../linked-list/problems/138-copy-list-with-random-pointer.md | #graph #clone #hashmap #dfs #bfs #undirected |
| 1584 | 1584. Min Cost to Connect All Points | MST — Prim / Kruskal (shortest-path / spanning-tree family) | Medium | 743:./743-network-delay-time.md; 684:./684-redundant-connection.md | #mst #prim #manhattan #complete-graph #greedy |
| 1976 | 1976. Number of Ways to Arrive at Destination | Dijkstra + counting (shortest-path family) | Medium | 743:./743-network-delay-time.md; 787:./787-cheapest-flights-within-k-stops.md | #dijkstra #counting #shortest-path #modulo #undirected |
| 200 | 200. Number of Islands | DFS / Backtracking (grid DFS) / BFS / Union-Find | Medium | 695:./695-max-area-of-island.md; 547:./547-number-of-provinces.md | #grid #dfs #flood-fill #connected-components #graphs |
| 207 | 207. Course Schedule | Topological Sort | Medium | 210:./210-course-schedule-ii.md; 269:./269-alien-dictionary.md; 802:../../advanced-graphs/problems/802-find-eventual-safe-states.md | #topological-sort #kahn #dfs-cycle #directed-graph #prerequisites |
| 210 | 210. Course Schedule II | Topological Sort | Medium | 207:./207-course-schedule.md; 269:./269-alien-dictionary.md; 329:../../dp-2d/problems/329-longest-increasing-path-in-a-matrix.md | #topological-sort #kahn #ordering #bfs-level #course-plan |
| 261 | 261. Graph Valid Tree | Union-Find or DFS connectivity | Medium | 323:./323-number-of-connected-components.md; 684:./684-redundant-connection.md | #union-find #tree #cycle #connectivity #edges-count |
| 269 | 269. Alien Dictionary | Topological sort on a character graph inferred from adjacent words | Hard | 207:./207-course-schedule.md; 210:./210-course-schedule-ii.md; 329:../../dp-2d/problems/329-longest-increasing-path-in-a-matrix.md | #topological-sort #character-graph #indegree #kahn-bfs #invalid-prefix-check |
| 286 | 286. Walls and Gates | BFS (multi-source shortest path on grid) | Medium | 994:./994-rotting-oranges.md; 743:./743-network-delay-time.md | #bfs #multi-source #grid #shortest-distance #in-place |
| 305 | 305. Number of Islands II | Union-Find (dynamic connectivity) on a sparse grid | Hard | 200:./200-number-of-islands.md; 323:./323-number-of-connected-components.md; 684:./684-redundant-connection.md | #union-find #dynamic-connectivity #grid-dsu #online-query #component-count |
| 323 | 323. Number of Connected Components in an Undirected Graph | Union-Find or DFS/BFS | Medium | 547:./547-number-of-provinces.md; 261:./261-graph-valid-tree.md | #union-find #components #undirected #connectivity |
| 332 | 332. Reconstruct Itinerary | Hierholzer’s algorithm (Eulerian circuit / trail) with DFS postorder | Hard | 207:./207-course-schedule.md; 269:./269-alien-dictionary.md; 210:./210-course-schedule-ii.md | #eulerian-trail #hierholzer #dfs-postorder #lexicographic #directed-multigraph |
| 417 | 417. Pacific Atlantic Water Flow | DFS / Backtracking (multi-source) | Medium | 200:./200-number-of-islands.md; 286:./286-walls-and-gates.md | #grid #dfs #multi-source #reverse-flow #matrix |
| 547 | 547. Number of Provinces | Union-Find or DFS on adjacency matrix | Medium | 323:./323-number-of-connected-components.md; 200:./200-number-of-islands.md | #dfs #adjacency-matrix #components #undirected |
| 684 | 684. Redundant Connection | Union-Find | Medium | 261:./261-graph-valid-tree.md; 323:./323-number-of-connected-components.md | #union-find #cycle #undirected #tree-plus-edge |
| 695 | 695. Max Area of Island | DFS / Backtracking | Medium | 200:./200-number-of-islands.md; 417:./417-pacific-atlantic-water-flow.md | #grid #dfs #area #connected-component |
| 743 | 743. Network Delay Time | Dijkstra shortest path (BFS family / weighted routing) | Medium | 787:./787-cheapest-flights-within-k-stops.md; 1976:./1976-number-of-ways-to-arrive-at-destination.md | #dijkstra #shortest-path #heap #directed #weighted |
| 778 | 778. Swim in Rising Water | Dijkstra / “minimize max edge” (path threshold) with min-heap | Hard | 743:./743-network-delay-time.md; 1631:../../advanced-graphs/problems/1631-path-with-minimum-effort.md; 127:./127-word-ladder.md | #dijkstra #minimax-path #grid-graph #priority-queue #binary-search-on-answer |
| 787 | 787. Cheapest Flights Within K Stops | Bellman-Ford / layered relaxation (shortest-path family) | Medium | 743:./743-network-delay-time.md; 1976:./1976-number-of-ways-to-arrive-at-destination.md | #bellman-ford #layered-relaxation #flights #shortest-path |
| 994 | 994. Rotting Oranges | BFS (multi-source, layered) | Medium | 286:./286-walls-and-gates.md; 200:./200-number-of-islands.md | #bfs #multi-source #grid #level-order #shortest-time |
| 45 | 45. Jump Game II | Greedy (level-wise farthest reach / BFS-like) | Medium | 55:./055-jump-game.md; 056:./056-merge-intervals.md; 134:./134-gas-station.md | #greedy #minimum-jumps #layered-bfs #medium |
| 55 | 55. Jump Game | Greedy (reach farthest index) | Medium | 45:./045-jump-game-ii.md; 056:./056-merge-intervals.md; 134:./134-gas-station.md | #greedy #reachability #farthest-index #medium |
| 56 | 56. Merge Intervals | Merge Intervals (sort by start, linear merge) | Medium | 435:./435-non-overlapping-intervals.md; 057:../../intervals/problems/057-insert-interval.md | #merge-intervals #sort #sweep-line #medium |
| 134 | 134. Gas Station | Greedy (single pass with restart) | Medium | 53:../../arrays-hashing/problems/053-maximum-subarray.md; 763:./763-partition-labels.md; 55:./055-jump-game.md | #greedy #circular-array #tank-balance #medium |
| 1899 | 1899. Merge Triplets to Form Target | Greedy (coordinate-wise feasibility filter) | Medium | 056:./056-merge-intervals.md; 435:./435-non-overlapping-intervals.md; 763:./763-partition-labels.md | #greedy #coordinate-max #filter #medium |
| 435 | 435. Non-overlapping Intervals | Greedy on intervals (pick earliest ending) | Medium | 056:./056-merge-intervals.md; 253:../../intervals/problems/253-meeting-rooms-ii.md; 252:../../intervals/problems/252-meeting-rooms.md | #intervals #greedy #activity-selection #medium |
| 678 | 678. Valid Parenthesis String | Greedy (balance range) / stack variant | Medium | 20:../../stack/problems/020-valid-parentheses.md; 763:./763-partition-labels.md; 055:./055-jump-game.md | #greedy #parentheses #wildcard #balance-range #medium |
| 763 | 763. Partition Labels | Greedy (scan + last occurrence map) | Medium | 056:./056-merge-intervals.md; 435:./435-non-overlapping-intervals.md; 1899:./1899-merge-triplets-to-form-target.md | #greedy #last-occurrence #string-partition #medium |
| 846 | 846. Hand of Straights | Greedy with ordered frequency map | Medium | 056:./056-merge-intervals.md; 435:./435-non-overlapping-intervals.md; 045:./045-jump-game-ii.md | #greedy #frequency-map #consecutive-groups #medium |
| 1046 | 1046. Last Stone Weight | Top-K / Heap (max-heap) | Easy | 703:./703-kth-largest-in-stream.md; 215:./215-kth-largest-element-in-array.md | #heap #max-heap #simulation #greedy #two-largest |
| 1834 | 1834. Single-Threaded CPU | Top-K / Heap (by processing time) + ordering | Medium | 621:./621-task-scheduler.md; 355:./355-design-twitter.md | #heap #scheduling #simulation #time-advance #greedy |
| 215 | 215. Kth Largest Element in an Array | Top-K / Heap | Medium | 703:./703-kth-largest-in-stream.md; 973:./973-k-closest-points-to-origin.md | #heap #quickselect #top-k #kth-largest #min-heap |
| 295 | 295. Find Median from Data Stream | Top-K / Heap (two heaps) | Hard | 703:./703-kth-largest-in-stream.md; 215:./215-kth-largest-element-in-array.md; 502:./502-ipo.md; 632:./632-smallest-range-covering-k-lists.md | #two-heaps #median #streaming #heap-balance #order-statistics #hard-design |
| 355 | 355. Design Twitter | Top-K / Heap + hash maps | Medium | 973:./973-k-closest-points-to-origin.md; 1834:./1834-single-threaded-cpu.md; 295:./295-find-median-from-data-stream.md | #design #heap #merge-k-streams #timestamp #social-graph |
| 502 | 502. IPO | Top-K / Heap (greedy + max-heap of profits) | Hard | 621:./621-task-scheduler.md; 215:./215-kth-largest-element-in-array.md; 295:./295-find-median-from-data-stream.md; 632:./632-smallest-range-covering-k-lists.md | #heap #greedy #sort-by-capital #k-rounds #maximize-capital #feasible-set |
| 621 | 621. Task Scheduler | Top-K / Heap (simulation) + greedy layout | Medium | 1046:./1046-last-stone-weight.md; 1834:./1834-single-threaded-cpu.md | #greedy #cooldown #frequency #math #heap-alternative |
| 632 | 632. Smallest Range Covering Elements from K Lists | Top-K / Heap (k-way min tracking + global max) with Sliding Window-style pointer advance | Hard | 21:../../linked-list/problems/021-merge-two-sorted-lists.md; 215:./215-kth-largest-element-in-array.md; 23:../../linked-list/problems/023-merge-k-sorted-lists.md | #k-way-merge #min-heap #running-max #sorted-lists #smallest-range #greedy-advance-min |
| 703 | 703. Kth Largest Element in a Stream | Top-K / Heap | Easy | 215:./215-kth-largest-element-in-array.md; 973:./973-k-closest-points-to-origin.md | #heap #min-heap #top-k #streaming #kth-largest #container-heap |
| 973 | 973. K Closest Points to Origin | Top-K / Heap | Medium | 215:./215-kth-largest-element-in-array.md; 703:./703-kth-largest-in-stream.md | #heap #max-heap-size-k #geometry #euclidean #top-k-smallest |
| 57 | 57. Insert Interval | Merge Intervals | Medium | 56:../../greedy/problems/056-merge-intervals.md; 253:./253-meeting-rooms-ii.md | #merge-intervals #insert #sweep #medium |
| 1851 | 1851. Minimum Interval to Include Each Query | Sort + sweep + Min-heap (offline queries) | Hard | 253:./253-meeting-rooms-ii.md; 218:./218-the-skyline-problem.md; 57:./057-insert-interval.md; 56:../../greedy/problems/056-merge-intervals.md | #offline-queries #interval-sweep #min-heap #sort-by-start #stale-pop |
| 218 | 218. The Skyline Problem | Sweep line + Heap / multiset (active heights) | Hard | 1851:./1851-min-interval-to-include-each-query.md; 253:./253-meeting-rooms-ii.md; 57:./057-insert-interval.md | #skyline #sweep-line #multiset-heights #edge-events #critical-points |
| 252 | 252. Meeting Rooms | Merge Intervals (sort + pairwise check) | Easy | 253:./253-meeting-rooms-ii.md; 435:../../greedy/problems/435-non-overlapping-intervals.md | #intervals #sort #overlap-check #easy |
| 253 | 253. Meeting Rooms II | Top-K / Heap (min-heap of end times) on timeline | Medium | 252:./252-meeting-rooms.md; 435:../../greedy/problems/435-non-overlapping-intervals.md | #heap #meeting-rooms #sweep-time #medium |
| 986 | 986. Interval List Intersections | Two Pointers on sorted interval lists | Medium | 56:../../greedy/problems/056-merge-intervals.md; 252:./252-meeting-rooms.md; 57:./057-insert-interval.md | #two-pointers #interval-intersection #sorted-lists #medium |
| 2 | 2. Add Two Numbers | Linked-list arithmetic (digit-wise with carry) | Medium | 21:./021-merge-two-sorted-lists.md; 138:./138-copy-list-with-random-pointer.md; 19:./019-remove-nth-from-end.md | #linked-list #carry #dummy-tail #school-addition |
| 19 | 19. Remove Nth Node From End of List | Fast & Slow Pointers (gap / offset) | Medium | 141:./141-linked-list-cycle.md; 143:./143-reorder-list.md; 206:./206-reverse-linked-list.md | #linked-list #two-pointer #dummy-head #nth-from-end |
| 21 | 21. Merge Two Sorted Lists | Merge (sorted streams) | Easy | 88:../../arrays-hashing/problems/088-merge-sorted-array.md; 143:./143-reorder-list.md; 206:./206-reverse-linked-list.md | #linked-list #merge #two-sorted #dummy-node |
| 023 | 023. Merge K Sorted Lists | Top-K / Heap or Divide & Conquer | Hard | 21:./021-merge-two-sorted-lists.md; 206:./206-reverse-linked-list.md; 25:./025-reverse-nodes-in-k-group.md | #k-way-merge #min-heap #divide-conquer #linked-list #multilist #hard-classic |
| 025 | 025. Reverse Nodes in k-Group | In-place Linked List Reversal | Hard | 206:./206-reverse-linked-list.md; 92:./092-reverse-linked-list-ii.md; 23:./023-merge-k-sorted-lists.md | #linked-list #reverse-range #k-group #dummy-node #in-place #hard-pointer |
| 92 | 92. Reverse Linked List II | In-place Linked List Reversal (Subrange) | Medium | 206:./206-reverse-linked-list.md; 143:./143-reorder-list.md; 234:./234-palindrome-linked-list.md | #linked-list #sublist-reverse #dummy-anchor #insert-front |
| 138 | 138. Copy List with Random Pointer | Hash map / interleaving clone | Medium | 133:../../graphs/problems/133-clone-graph.md; 21:./021-merge-two-sorted-lists.md; 143:./143-reorder-list.md | #linked-list #deep-copy #random-pointer #interleave-unzip |
| 141 | 141. Linked List Cycle | Fast & Slow Pointers (Floyd’s cycle) | Easy | 142:./142-linked-list-cycle-ii.md; 287:./287-find-the-duplicate-number.md; 19:./019-remove-nth-from-end.md | #linked-list #floyd #cycle-detection #fast-slow |
| 142 | 142. Linked List Cycle II | Fast & Slow Pointers (Floyd + entry) | Medium | 141:./141-linked-list-cycle.md; 287:./287-find-the-duplicate-number.md; 202:../../math-geometry/problems/202-happy-number.md | #linked-list #floyd #cycle-entry #fast-slow |
| 143 | 143. Reorder List | In-place Linked List Reversal + merge | Medium | 206:./206-reverse-linked-list.md; 234:./234-palindrome-linked-list.md; 21:./021-merge-two-sorted-lists.md | #linked-list #split-list #reverse-half #interleave-merge |
| 146 | 146. LRU Cache | Hash map + doubly linked list (recency ordering) | Medium | 138:./138-copy-list-with-random-pointer.md; 21:./021-merge-two-sorted-lists.md; 2:./002-add-two-numbers.md | #design #hashmap #doubly-linked-list #eviction #recency |
| 206 | 206. Reverse Linked List | In-place Linked List Reversal | Easy | 92:./092-reverse-linked-list-ii.md; 234:./234-palindrome-linked-list.md; 143:./143-reorder-list.md | #linked-list #in-place #three-pointer #reversal |
| 234 | 234. Palindrome Linked List | In-place Linked List Reversal + Fast & Slow | Easy | 206:./206-reverse-linked-list.md; 143:./143-reorder-list.md; 92:./092-reverse-linked-list-ii.md | #linked-list #palindrome #middle-split #reverse-half |
| 287 | 287. Find the Duplicate Number | Fast & Slow Pointers (Floyd on implicit graph) | Medium | 142:./142-linked-list-cycle-ii.md; 141:./141-linked-list-cycle.md; 202:../../math-geometry/problems/202-happy-number.md | #floyd #index-graph #pigeonhole #cycle-entry |
| 7 | 7. Reverse Integer | Math + overflow guard (canonical home for this problem) | Medium | 009:./009-palindrome-number.md; 008:./008-string-to-integer-atoi.md | #overflow #digit-manipulation #math #int32-bounds |
| 8 | 8. String to Integer (atoi) | Parsing (state / deterministic scan) | Medium | 007:./007-reverse-integer.md; 066:./066-plus-one.md | #parsing #atoi #overflow-clamp #string-scan |
| 9 | 9. Palindrome Number | Reverse half (integer / math) | Easy | 125:../../two-pointers/problems/125-valid-palindrome.md; 007:./007-reverse-integer.md | #palindrome #reverse-half #math #no-extra-space |
| 43 | 43. Multiply Strings | String math (grade-school multiplication) | Medium | 066:./066-plus-one.md; 050:./050-pow-x-n.md | #string-math #grade-school #carry #digit-array #multiply |
| 50 | 50. Pow(x, n) | Fast exponentiation (Divide & Conquer) | Medium | 372:./372-super-pow.md; 043:./043-multiply-strings.md | #fast-exponentiation #binary-exponentiation #divide-conquer #math |
| 66 | 66. Plus One | Math simulation (grade-school carry) | Easy | 43:./043-multiply-strings.md; 50:./050-pow-x-n.md | #carry #digits #simulation #array #math |
| 149 | 149. Max Points on a Line | Co-linearity via reduced slope (hash map) — plain text + prefix patterns not central | Hard | 202:./202-happy-number.md; 43:./043-multiply-strings.md; 233:./233-number-of-digit-one.md | #slope-hash #gcd-normalize #duplicates #pair-key #o-n-squared |
| 202 | 202. Happy Number | Cycle detection (Fast & Slow Pointers); digit simulation | Easy | 009:./009-palindrome-number.md; 050:./050-pow-x-n.md | #cycle-detection #floyd #digit-sum #math-simulation #happy-number |
| 233 | 233. Number of Digit One | Digit / positional counting + Dynamic Programming — digit DP (constructive closed form here) | Hard | 50:./050-pow-x-n.md; 43:./043-multiply-strings.md; 149:./149-max-points-on-a-line.md | #digit-dp #positional-count #high-current-low #range-aggregate #math-trick |
| 372 | 372. Super Pow | Modular exponentiation (Divide & Conquer) | Medium | 050:./050-pow-x-n.md; 043:./043-multiply-strings.md | #modular-exponentiation #super-pow #digit-array #recurrence #math |
| 003 | 003. Longest Substring Without Repeating Characters | Sliding Window | Medium | 567:./567-permutation-in-string.md; 438:./438-find-all-anagrams-in-a-string.md; 209:./209-minimum-size-subarray-sum.md | #sliding-window #variable-window #unique-chars #last-seen #expand-contract |
| 030 | 030. Substring with Concatenation of All Words | Sliding Window (fixed multi-unit window + hash map) | Hard | 567:./567-permutation-in-string.md; 438:./438-find-all-anagrams-in-a-string.md; 76:./076-minimum-window-substring.md | #sliding-window #fixed-window #multiset #word-grid-offset #same-length-words #hard-string |
| 076 | 076. Minimum Window Substring | Sliding Window (variable window + need/have) | Hard | 3:./003-longest-substring-without-repeating.md; 567:./567-permutation-in-string.md; 30:./030-substring-with-concatenation-of-all-words.md | #sliding-window #minimum-window #need-have #formed #two-map #hard-string |
| 1004 | 1004. Max Consecutive Ones III | Sliding Window | Medium | 424:./424-longest-repeating-character-replacement.md; 904:./904-fruit-into-baskets.md; 209:./209-minimum-size-subarray-sum.md | #sliding-window #binary-array #zero-budget #flip #maximize-length |
| 209 | 209. Minimum Size Subarray Sum | Sliding Window | Medium | 904:./904-fruit-into-baskets.md; 3:./003-longest-substring-without-repeating.md; 121:../../arrays-hashing/problems/121-best-time-to-buy-sell-stock.md | #sliding-window #variable-window #prefix-sum-window #positive-integers #minimum-length |
| 239 | 239. Sliding Window Maximum | Monotonic Deque / Stack (queue variant) | Hard | 739:../../stack/problems/739-daily-temperatures.md; 424:./424-longest-repeating-character-replacement.md; 76:./076-minimum-window-substring.md | #sliding-window #monotonic-deque #fixed-k #amortized-O1 #queue-indices |
| 424 | 424. Longest Repeating Character Replacement | Sliding Window | Medium | 1004:./1004-max-consecutive-ones-iii.md; 904:./904-fruit-into-baskets.md; 3:./003-longest-substring-without-repeating.md | #sliding-window #frequency #budget #maximize-window #uppercase-english |
| 438 | 438. Find All Anagrams in a String | Sliding Window | Medium | 567:./567-permutation-in-string.md; 3:./003-longest-substring-without-repeating.md; 049:../../arrays-hashing/problems/049-group-anagrams.md | #sliding-window #fixed-window #anagram #all-indices #frequency-match |
| 567 | 567. Permutation in String | Sliding Window | Medium | 438:./438-find-all-anagrams-in-a-string.md; 3:./003-longest-substring-without-repeating.md; 209:./209-minimum-size-subarray-sum.md | #sliding-window #fixed-window #anagram #frequency-vector #lowercase-english |
| 904 | 904. Fruit Into Baskets | Sliding Window | Medium | 424:./424-longest-repeating-character-replacement.md; 3:./003-longest-substring-without-repeating.md; 1004:./1004-max-consecutive-ones-iii.md | #sliding-window #at-most-k-distinct #two-types #frequency-map #longest-window |
| 992 | 992. Subarrays with K Different Integers | Sliding Window (at-most trick) | Hard | 904:./904-fruit-into-baskets.md; 424:./424-longest-repeating-character-replacement.md; 76:./076-minimum-window-substring.md | #sliding-window #exactly-k #at-most-trick #subarray-count #frequency-map #hard-classic |
| 020 | 020. Valid Parentheses | Stack Match | Easy | 22:./022-generate-parentheses.md; 394:./394-decode-string.md; 71:./071-simplify-path.md | #stack #parentheses #lifo #matching #brackets |
| 022 | 022. Generate Parentheses | DFS / Backtracking | Medium | 020:./020-valid-parentheses.md; 150:./150-evaluate-reverse-polish-notation.md; 394:./394-decode-string.md | #backtracking #parentheses #catalan #constraints #dfs |
| 071 | 071. Simplify Path | Stack (token processing) | Medium | 020:./020-valid-parentheses.md; 394:./394-decode-string.md; 150:./150-evaluate-reverse-polish-notation.md | #stack #path #tokenize #normalize #unix-path |
| 084 | 084. Largest Rectangle in Histogram | Monotonic Stack / Queue | Hard | 739:./739-daily-temperatures.md; 42:../../two-pointers/problems/042-trapping-rain-water.md; 239:../../sliding-window/problems/239-sliding-window-maximum.md | #monotonic-stack #histogram #largest-rectangle #sentinel-pop #width-from-boundaries #cartesian-tree |
| 150 | 150. Evaluate Reverse Polish Notation | Stack evaluation | Medium | 394:./394-decode-string.md; 020:./020-valid-parentheses.md; 022:./022-generate-parentheses.md | #stack #rpn #postfix #operators #integer-division |
| 155 | 155. Min Stack | Stack + auxiliary min history | Medium | 020:./020-valid-parentheses.md; 739:./739-daily-temperatures.md; 232:./232-implement-queue-using-stacks.md | #stack #auxiliary-stack #min-tracking #amortized-o1 #design |
| 232 | 232. Implement Queue using Stacks | Two Stacks (amortized queue) | Easy | 155:./155-min-stack.md; 020:./020-valid-parentheses.md; 150:./150-evaluate-reverse-polish-notation.md | #stack #queue #two-stack #amortized #fifo |
| 394 | 394. Decode String | Stack (nested expansion) | Medium | 20:./020-valid-parentheses.md; 22:./022-generate-parentheses.md; 739:./739-daily-temperatures.md | #stack #nested-brackets #decode #repeat-string #multi-digit-parse |
| 739 | 739. Daily Temperatures | Monotonic Stack | Medium | 853:./853-car-fleet.md; 020:./020-valid-parentheses.md; 394:./394-decode-string.md | #monotonic-stack #next-greater #indices #waiting-days #linear-time |
| 853 | 853. Car Fleet | Two Pointers + monotonic speed ordering | Medium | 739:./739-daily-temperatures.md; 167:../../two-pointers/problems/167-two-sum-ii.md; 11:../../two-pointers/problems/011-container-with-most-water.md | #stack #sort-by-position #arrival-time #merge-fleets #greedy |
| 1166 | 1166. Design File System | Trie path composition (Trie) | Medium | 208:../../tries/problems/208-implement-trie.md; 706:./706-design-hashmap.md | #trie #paths #prefix #filesystem #design |
| 1396 | 1396. Design Underground System | Hash maps (trip state + rolling aggregates) | Medium | 1166:./1166-design-file-system.md; 380:./380-insert-delete-getrandom-o1.md | #hash-map #streaming-stats #rolling-average #systems-design-lite |
| 380 | 380. Insert Delete GetRandom O(1) | Hash + Array swap-remove | Medium | 146:../../linked-list/problems/146-lru-cache.md; 355:../../heap-priority-queue/problems/355-design-twitter.md | #hash-map #dynamic-array #swap-remove #random-choice #o1 |
| 381 | 381. Insert Delete GetRandom O(1) — Duplicates Allowed | Hash map (value → set of indices) + dense dynamic array, swap-with-last remove (extends 380. Insert | Hard | 380:./380-insert-delete-getrandom-o1.md; 146:../../linked-list/problems/146-lru-cache.md; 460:./460-lfu-cache.md | #hash-set-per-value #dynamic-array #swap-remove #multiset #amortized-o1 #random-sampling |
| 432 | 432. All O`one Data Structure | Doubly linked list of count buckets + hash maps (adjacent to 460. LFU / 146. LRU thinking — freq | Hard | 460:./460-lfu-cache.md; 146:../../linked-list/problems/146-lru-cache.md; 347:../../arrays-hashing/problems/347-top-k-frequent-elements.md | #doubly-linked-list #frequency-bucket #hash-map #min-max-tracking #o1-amortized |
| 460 | 460. LFU Cache | Two-level hash + doubly linked lists per frequency (cousin of 146. LRU Cache — eviction policy diffe | Hard | 146:../../linked-list/problems/146-lru-cache.md; 432:./432-all-oone-data-structure.md; 380:./380-insert-delete-getrandom-o1.md | #lfu #doubly-linked-list #hash-map #frequency-buckets #min-frequency-pointer #eviction-policy |
| 588 | 588. Design In-Memory File System | Trie / prefix tree over path segments + per-node metadata (isFile, content) | Hard | 1166:./1166-design-file-system.md; 208:../../tries/problems/208-implement-trie.md; 642:./642-design-search-autocomplete-system.md | #trie #path-segments #tree-of-maps #sorted-ls #in-memory-fs |
| 622 | 622. Design Circular Queue | Array + front/rear pointers | Medium | 641:./641-design-circular-deque.md; 232:../../stack/problems/232-implement-queue-using-stacks.md | #circular-buffer #modulo-index #fixed-capacity #queue #array |
| 641 | 641. Design Circular Deque | Array + front/rear pointers | Medium | 622:./622-design-circular-queue.md; 707:./707-design-linked-list.md | #deque #ring-buffer #two-ended #array #modulo |
| 642 | 642. Design Search Autocomplete System | Trie for prefix reachability + Top-K / Heap or offline sort per query | Hard | 1268:../../tries/problems/1268-search-suggestions-system.md; 208:../../tries/problems/208-implement-trie.md; 355:../../heap-priority-queue/problems/355-design-twitter.md | #trie #prefix-search #top-k #custom-comparator #streaming-input #autocomplete |
| 706 | 706. Design HashMap | Bucket array with chaining | Easy | 380:./380-insert-delete-getrandom-o1.md; 1396:./1396-design-underground-system.md | #hash-table #separate-chaining #mod-prime #collision-handling |
| 707 | 707. Design Linked List | Linked list ops with sentinel | Medium | 206:../../linked-list/problems/206-reverse-linked-list.md; 707 vs 622:./622-design-circular-queue.md | #linked-list #sentinel-node #index-walk #design |
| 98 | 98. Validate Binary Search Tree | Tree DFS with bounds | Medium | 230:./230-kth-smallest-in-bst.md; 235:./235-lowest-common-ancestor-of-bst.md; 173:./173-binary-search-tree-iterator.md | #trees #bst #dfs #bounds #interval-validation |
| 100 | 100. Same Tree | Tree DFS | Easy | 572:./572-subtree-of-another-tree.md; 226:./226-invert-binary-tree.md; 235:./235-lowest-common-ancestor-of-bst.md | #trees #dfs #structural-equality #recursion #pair-traversal |
| 102 | 102. Binary Tree Level Order Traversal | BFS | Medium | 199:./199-binary-tree-right-side-view.md; 116:./116-populating-next-right-pointers.md; 104:./104-maximum-depth-of-binary-tree.md | #trees #bfs #level-order #queue #by-level |
| 104 | 104. Maximum Depth of Binary Tree | Tree DFS | Easy | 226:./226-invert-binary-tree.md; 110:./110-balanced-binary-tree.md; 543:./543-diameter-of-binary-tree.md | #trees #dfs #height #recursion #divide-and-conquer-on-tree |
| 105 | 105. Construct Binary Tree from Preorder and Inorder Traversal | Tree DFS (divide by root) | Medium | 100:./100-same-tree.md; 098:./098-validate-bst.md; 226:./226-invert-binary-tree.md | #trees #dfs #preorder #inorder #divide-conquer #hash-index |
| 110 | 110. Balanced Binary Tree | Tree DFS (post-order) | Easy | 104:./104-maximum-depth-of-binary-tree.md; 543:./543-diameter-of-binary-tree.md; 236:./236-lowest-common-ancestor-of-binary-tree.md | #trees #post-order #height #sentinel #bubble-up-failure |
| 113 | 113. Path Sum II | Tree DFS + backtracking and DFS / backtracking | Medium | 437:./437-path-sum-iii.md; 257:./257-binary-tree-paths.md; 104:./104-maximum-depth-of-binary-tree.md | #trees #backtracking #root-to-leaf #path-buffer #copy-on-record |
| 116 | 116. Populating Next Right Pointers in Each Node | BFS (or O(1) extra using next links) | Medium | 102:./102-binary-tree-level-order-traversal.md; 199:./199-binary-tree-right-side-view.md; 236:./236-lowest-common-ancestor-of-binary-tree.md | #trees #bfs #next-pointer #perfect-tree #o1-space-trick |
| 124 | 124. Binary Tree Maximum Path Sum | Tree DFS / DP on Trees | Hard | 543:./543-diameter-of-binary-tree.md; 113:./113-path-sum-ii.md; 297:./297-serialize-deserialize-binary-tree.md | #tree-dp #max-path #post-order #negative-weights #arch-vs-chain #global-best |
| 1448 | 1448. Count Good Nodes in Binary Tree | Tree DFS (path max so far) | Medium | 104:./104-maximum-depth-of-binary-tree.md; 437:./437-path-sum-iii.md; 113:./113-path-sum-ii.md | #trees #dfs #path-parameter #running-max #good-node |
| 173 | 173. Binary Search Tree Iterator | Iterative inorder (stack) | Medium | 230:./230-kth-smallest-in-bst.md; 098:./098-validate-bst.md; 235:./235-lowest-common-ancestor-of-bst.md | #trees #bst #iterator #stack #lazy-inorder |
| 199 | 199. Binary Tree Right Side View | BFS | Medium | 102:./102-binary-tree-level-order-traversal.md; 116:./116-populating-next-right-pointers.md; 1448:./1448-count-good-nodes-in-binary-tree.md | #trees #bfs #rightmost #level-order #visibility |
| 222 | 222. Count Complete Tree Nodes | Binary search on tree using heights along left/right spines | Easy | 104:./104-maximum-depth-of-binary-tree.md; 110:./110-balanced-binary-tree.md; 098:./098-validate-bst.md | #trees #complete-binary-tree #binary-search #height-trick #perfect-subtree |
| 226 | 226. Invert Binary Tree | Tree DFS | Easy | 100:./100-same-tree.md; 572:./572-subtree-of-another-tree.md; 104:./104-maximum-depth-of-binary-tree.md | #trees #dfs #invert #mirror #swap-children |
| 230 | 230. Kth Smallest Element in a BST | Inorder traversal on BST | Medium | 098:./098-validate-bst.md; 173:./173-binary-search-tree-iterator.md; 235:./235-lowest-common-ancestor-of-bst.md | #trees #bst #inorder #stack #kth-order-statistic |
| 235 | 235. Lowest Common Ancestor of a Binary Search Tree | BST property (search-space shrink from ordered keys) | Medium | 236:./236-lowest-common-ancestor-of-binary-tree.md; 230:./230-kth-smallest-in-bst.md; 098:./098-validate-bst.md | #trees #bst #lca #range-split #iterative-walk |
| 236 | 236. Lowest Common Ancestor of a Binary Tree | Tree DFS | Medium | 235:./235-lowest-common-ancestor-of-bst.md; 572:./572-subtree-of-another-tree.md; 100:./100-same-tree.md | #trees #lca #post-order #divide #bubble-result |
| 257 | 257. Binary Tree Paths | Tree DFS + backtracking and DFS / backtracking | Easy | 113:./113-path-sum-ii.md; 437:./437-path-sum-iii.md; 102:./102-binary-tree-level-order-traversal.md | #trees #backtracking #root-to-leaf #string-build #dfs |
| 297 | 297. Serialize and Deserialize Binary Tree | Tree DFS / String encoding | Hard | 105:./105-build-tree-from-preorder-inorder.md; 1448:./1448-count-good-nodes-in-binary-tree.md; 124:./124-binary-tree-maximum-path-sum.md | #tree #serialize #preorder #sentinel #codec #dfs #reconstruct |
| 437 | 437. Path Sum III | Prefix sum on tree + Tree DFS | Medium | 113:./113-path-sum-ii.md; 1448:./1448-count-good-nodes-in-binary-tree.md; 543:./543-diameter-of-binary-tree.md | #trees #prefix-sum #hashmap #backtrack-unwind #path-count |
| 543 | 543. Diameter of Binary Tree | Tree DFS (DP on tree) | Easy | 104:./104-maximum-depth-of-binary-tree.md; 110:./110-balanced-binary-tree.md; 437:./437-path-sum-iii.md | #trees #dp-on-tree #post-order #diameter #global-best |
| 572 | 572. Subtree of Another Tree | Tree DFS + isSame pattern | Easy | 100:./100-same-tree.md; 104:./104-maximum-depth-of-binary-tree.md; 235:./235-lowest-common-ancestor-of-bst.md | #trees #dfs #subtree #same-tree-helper #or-recursion |
| 1268 | 1268. Search Suggestions System | Trie (alternative: sort + binary search on products) | Medium | 208:./208-implement-trie.md; 648:./648-replace-words.md; 211:./211-design-add-and-search-words.md | #trie #autocomplete #lex-order #prefix-search #dfs-limit |
| 208 | 208. Implement Trie (Prefix Tree) | Trie | Medium | 211:./211-design-add-and-search-words.md; 648:./648-replace-words.md; 1268:./1268-search-suggestions-system.md | #trie #prefix-tree #insert #search #startsWith |
| 211 | 211. Design Add and Search Words Data Structure | Trie + DFS on wildcards and DFS / backtracking | Medium | 208:./208-implement-trie.md; 1268:./1268-search-suggestions-system.md; 648:./648-replace-words.md | #trie #wildcard #dfs #backtracking #dictionary-design |
| 212 | 212. Word Search II | Trie + DFS / Backtracking | Hard | 79:../../backtracking/problems/079-word-search.md; 208:./208-implement-trie.md; 30:../../sliding-window/problems/030-substring-with-concatenation-of-all-words.md | #trie #backtracking #word-search #prune #grid-dfs #hard-classic #prefix-tree |
| 648 | 648. Replace Words | Trie | Medium | 208:./208-implement-trie.md; 211:./211-design-add-and-search-words.md; 1268:./1268-search-suggestions-system.md | #trie #prefix #replace #sentence #shortest-match |
| 011 | 011. Container With Most Water | Two Pointers | Medium | 15:./015-3sum.md; 125:./125-valid-palindrome.md; 167:./167-two-sum-ii.md | #two-pointers #greedy-area #inward-pointers #max-min-product |
| 015 | 015. 3Sum | Two Pointers | Medium | 16:./016-3sum-closest.md; 18:./018-4sum.md; 167:./167-two-sum-ii.md | #two-pointers #sort #dedupe #triplet #two-sum-extension |
| 016 | 016. 3Sum Closest | Two Pointers | Medium | 15:./015-3sum.md; 18:./018-4sum.md; 167:./167-two-sum-ii.md | #two-pointers #sort #closest-sum #absolute-diff #triplet |
| 018 | 018. 4Sum | Two Pointers | Medium | 15:./015-3sum.md; 16:./016-3sum-closest.md; 167:./167-two-sum-ii.md | #two-pointers #sort #dedupe #ksum #nested-loops |
| 042 | 042. Trapping Rain Water | Two Pointers (also Dynamic Programming as equivalent formulation) | Hard | 11:./011-container-with-most-water.md; 15:./015-3sum.md; 84:../../stack/problems/084-largest-rectangle-in-histogram.md | #two-pointers #rain-water #invariant #histogram #O1-space #two-pass-alternative |
| 075 | 075. Sort Colors | Dutch National Flag (three-way partition) | Medium | 283:./283-move-zeroes.md; 11:./011-container-with-most-water.md; 125:./125-valid-palindrome.md | #dutch-national-flag #three-way-partition #in-place #linear-time |
| 125 | 125. Valid Palindrome | Two Pointers | Easy | 680:./680-valid-palindrome-ii.md; 167:./167-two-sum-ii.md; 11:./011-container-with-most-water.md | #two-pointers #palindrome #alphanumeric #inward-convergence #string |
| 167 | 167. Two Sum II — Input Array Is Sorted | Two Pointers | Medium | 1:../../arrays-hashing/problems/001-two-sum.md; 15:./015-3sum.md; 11:./011-container-with-most-water.md | #two-pointers #sorted-array #pair-sum #one-indexed |
| 283 | 283. Move Zeroes | Two Pointers | Easy | 75:./075-sort-colors.md; 27:../../arrays-hashing/problems/027-remove-element.md; 125:./125-valid-palindrome.md | #two-pointers #in-place #partition #stable-order #swap-write |
| 392 | 392. Is Subsequence | Two Pointers | Easy | 125:./125-valid-palindrome.md; 680:./680-valid-palindrome-ii.md; 283:./283-move-zeroes.md | #two-pointers #subsequence #greedy-match #string-scan |
| 680 | 680. Valid Palindrome II | Two Pointers + single skip | Easy | 125:./125-valid-palindrome.md; 392:./392-is-subsequence.md; 167:./167-two-sum-ii.md | #two-pointers #palindrome #one-deletion #two-checks |
Last updated on
Spotted something unclear or wrong on this page?