Binary Search

March 18, 2026 · 0 min · map[name:Jeanphilo]

Hot100: Permutations (used[] Backtracking ACERS Guide)

Subtitle / Summary If Subsets teaches the skeleton of combination-style backtracking, Permutations teaches the core of state-based backtracking: at each position, choose one unused element, continue until the path length reaches n, and only then collect the answer. Reading time: 10-12 min Tags: Hot100, backtracking, permutations, DFS SEO keywords: Permutations, backtracking, used array, DFS, LeetCode 46 Meta description: Learn the stable permutation backtracking template for LeetCode 46, with state recovery, engineering analogies, and runnable multi-language solutions. Target Readers Hot100 learners who have already finished 78. Subsets and want the next backtracking template Developers who understand recursion but still make mistakes when restoring state Engineers who need to enumerate execution orders, test sequences, or ordering-sensitive plans Background / Motivation The key difference between combinations and permutations is simple: ...

April 3, 2026 · 8 min · map[name:Jeanphilo]

Hot100: Subsets (Backtracking / startIndex ACERS Guide)

Subtitle / Summary Subsets is the cleanest entry point into Hot100 backtracking. The main thing to stabilize is not “enumerate everything”, but the three invariants behind the template: path, startIndex, and “every node is already a valid answer”. Reading time: 10-12 min Tags: Hot100, backtracking, subsets, DFS SEO keywords: Subsets, backtracking, startIndex, power set, LeetCode 78 Meta description: Learn the stable backtracking template for LeetCode 78, with engineering analogies, pitfalls, and runnable multi-language solutions. Target Readers Hot100 learners starting the backtracking block today Developers who can write DFS but still mix up combinations and permutations Engineers who need to enumerate feature sets, candidate policies, or configuration bundles Background / Motivation Many “real” problems reduce to a subset model: ...

April 2, 2026 · 7 min · map[name:Jeanphilo]

LeetCode 133: Clone Graph Hash Map + DFS/BFS ACERS Guide

Subtitle / Summary Clone Graph is not a traversal-only problem. The real challenge is preserving graph structure while avoiding duplicate copies in the presence of cycles. The stable solution is a traversal plus a hash map from original nodes to cloned nodes. Reading time: 12-15 min Tags: graph, dfs, bfs, hash map, deep copy SEO keywords: Clone Graph, graph deep copy, DFS, BFS, LeetCode 133 Meta description: Deep-copy an undirected graph with a node-to-node map, explaining why memoization is mandatory and how DFS/BFS versions work, with runnable code in six languages. Target Readers LeetCode learners practicing graph traversal and deep-copy patterns Engineers who duplicate object graphs, workflow graphs, or topology graphs Developers who want one reusable template for “clone with cycles” Background / Motivation Many “copy” problems are actually identity-preservation problems. ...

March 19, 2026 · 11 min · map[name:Jeanphilo]

Hot100: Binary Tree Level Order Traversal (BFS / DFS ACERS Guide)

Subtitle / Summary Level order traversal is the entry point of the binary-tree BFS template. The real key is not merely “use a queue”, but “separate one level from the next correctly”. This ACERS guide explains the level-size pattern, the DFS depth-bucket alternative, and engineering situations where grouped-by-depth traversal is useful. Reading time: 10-12 min Tags: Hot100, binary tree, BFS, DFS, queue, level order traversal SEO keywords: Hot100, Binary Tree Level Order Traversal, BFS, queue, level order traversal, LeetCode 102 Meta description: A systematic guide to LeetCode 102 from level-by-level BFS to DFS depth buckets, with engineering scenarios and runnable multi-language implementations. Target Readers Hot100 learners who want to make the BFS tree template stable Developers who can traverse a tree but still mix up current-level and next-level boundaries Engineers who need to group tree-shaped data by depth for display or execution Background / Motivation LeetCode 102 is one of the most standard tree-BFS starter problems. ...

March 16, 2026 · 12 min · map[name:Jeanphilo]

Hot100: Symmetric Tree (Mirror Recursion / BFS ACERS Guide)

Subtitle / Summary The hard part of Symmetric Tree is not traversal itself, but comparison direction. You are not comparing left to left and right to right. You are comparing mirrored positions. This ACERS guide explains the mirror-recursion contract, the BFS queue-of-pairs variant, and real engineering cases where symmetry checking matters. Reading time: 10-12 min Tags: Hot100, binary tree, DFS, BFS, symmetry SEO keywords: Hot100, Symmetric Tree, mirror recursion, binary tree symmetry, BFS, LeetCode 101 Meta description: A systematic guide to LeetCode 101 from mirror recursion to pairwise BFS symmetry checks, with engineering scenarios and runnable multi-language implementations. Target Readers Hot100 learners moving from Same Tree to mirror comparison Developers who can write ordinary tree recursion but still mix up outside and inside pairs Engineers who need left-right symmetry validation for layouts, topology templates, or mirrored structures Background / Motivation LeetCode 101 is excellent training for directional thinking in tree problems: ...

March 16, 2026 · 11 min · map[name:Jeanphilo]

Hot100: Same Tree (Synchronous Recursion / BFS ACERS Guide)

Subtitle / Summary The real challenge in LeetCode 100 is not “can you traverse a tree”, but “can you compare two trees node by node in lockstep”. This ACERS guide explains the synchronous-recursion contract, the queue-of-pairs BFS variant, and why the pattern matters in real engineering work. Reading time: 9-11 min Tags: Hot100, binary tree, DFS, BFS, tree comparison SEO keywords: Hot100, Same Tree, binary tree comparison, synchronous recursion, BFS, LeetCode 100 Meta description: A systematic guide to LeetCode 100 from synchronous recursion to pairwise BFS comparison, with engineering scenarios and runnable multi-language implementations. Target Readers Hot100 learners who want to build a stable “compare two trees together” template Developers who can write DFS on one tree but get confused once two trees must be checked in parallel Engineers who need structural-equivalence checks for config trees, component trees, or syntax trees Background / Motivation When many people first see LeetCode 100, the instinct is: ...

March 16, 2026 · 11 min · map[name:Jeanphilo]

Hot100: Invert Binary Tree (Recursion / BFS ACERS Guide)

Subtitle / Summary Invert Binary Tree looks tiny, but it is one of the fastest ways to test whether you really understand recursive structure on trees. This guide uses LeetCode 226 to break down the essence of “swap left and right subtrees”, covers both recursion and BFS, and shows how the same idea transfers to engineering scenarios. Reading time: 8-10 min Tags: Hot100, binary tree, recursion, BFS, tree transformation SEO keywords: Hot100, Invert Binary Tree, tree mirror, recursion, BFS, LeetCode 226 Meta description: Learn the recursive and BFS solutions for LeetCode 226, then extend the idea to layout mirroring and structural transformations. Target Readers Hot100 learners who want to verify whether they truly understand “apply recursion to every node in the whole tree” Developers who instinctively start traversing any tree problem, but are unsure when to process the current node Engineers who need tree mirroring, layout inversion, or symmetric structural transforms Background / Motivation The code for LeetCode 226 is usually very short, but the thinking pattern is extremely typical: ...

March 6, 2026 · 10 min · map[name:Jeanphilo]

Hot100: Maximum Depth of Binary Tree (DFS / BFS ACERS Guide)

Subtitle / Summary “Maximum depth” is one of the cleanest starting points for tree recursion. Once you truly understand that the answer for the current tree depends on the answers from its left and right subtrees, a whole family of tree DP and DFS problems becomes easier. This guide uses LeetCode 104 to explain recursive DFS, level-order BFS, and the engineering value of the same pattern. Reading time: 9-11 min Tags: Hot100, binary tree, DFS, BFS, recursion SEO keywords: Hot100, Maximum Depth of Binary Tree, DFS, BFS, LeetCode 104 Meta description: Learn the DFS and BFS solutions for LeetCode 104 from the definition of depth, with engineering mappings and runnable multi-language code. Target Readers Learners who are just starting tree problems and want to truly internalize “tree recursion return values” Developers who can write traversals but get confused once the task becomes “compute height”, “compute path”, or “compute an answer” Engineers who need depth analysis on hierarchical data such as menus, org charts, or nested JSON Background / Motivation LeetCode 104 looks like an easy problem, but it is almost the parent problem of tree recursion: ...

March 6, 2026 · 9 min · map[name:Jeanphilo]

Hot100: Binary Tree Inorder Traversal (Recursion / Stack ACERS Guide)

Subtitle / Summary Binary tree traversal is the starting point of most tree templates, and inorder traversal is one of the cleanest problems for understanding both recursive thinking and explicit stack simulation. This ACERS guide uses LeetCode 94 to explain the left-root-right order, the iterative stack template, and why the pattern matters in real engineering work. Reading time: 10-12 min Tags: Hot100, binary tree, DFS, stack, inorder traversal SEO keywords: Hot100, Binary Tree Inorder Traversal, inorder traversal, explicit stack, LeetCode 94 Meta description: A systematic guide to LeetCode 94 from recursion to explicit stacks, with engineering scenarios and runnable multi-language implementations. Target Readers Hot100 learners who want to lock in a stable tree-traversal template Developers moving from arrays and linked lists to trees, and still mixing up preorder, inorder, and postorder Engineers who want to reuse the left-root-right idea in BSTs, expression trees, or syntax trees Background / Motivation Inorder traversal is not hard by itself, but its training value is high: ...

March 6, 2026 · 11 min · map[name:Jeanphilo]

LeetCode 146: LRU Cache Design with O(1) Hash Map + Doubly Linked List

Subtitle / Summary This is not a memorization question. It is core cache-engineering practice: satisfy fast lookup and least-recently-used eviction at the same time, both in constant average time. We derive the optimal structure from naive approaches and provide runnable implementations. Reading time: 14-18 min Tags: LRU, hash map, doubly linked list, system design SEO keywords: LRU Cache, LeetCode 146, hash map, doubly linked list, O(1) Meta description: Build an LRU cache with hash map + doubly linked list to achieve O(1) average get/put, with engineering use cases, pitfalls, and six-language implementations. Target Readers LeetCode learners who want to master data-structure composition Backend/middleware engineers implementing local caches Interview candidates who know the answer headline but not the invariants Background / Motivation Caching trades space for time, but cache space is limited. When full, we must evict keys. LRU (Least Recently Used) assumes: ...

February 12, 2026 · 14 min · map[name:Jeanphilo]