Hot100: Binary Tree Maximum Path Sum (Tree DP / Single-Side Gain ACERS Guide)

Subtitle / Summary The easiest way to get lost in LeetCode 124 is to make one recursive return value carry too much meaning. The stable design is to separate two roles: the recursion returns only the best single-side gain to the parent, while the full path through the current node is used to update the global maximum. Reading time: 12-15 min Tags: Hot100, binary tree, tree DP, DFS, postorder SEO keywords: Binary Tree Maximum Path Sum, tree DP, single-side gain, postorder, DFS, LeetCode 124 Meta description: Learn LeetCode 124 from the single-side gain invariant, global path update, and negative-branch pruning, with runnable multi-language implementations. A — Algorithm Problem Restatement A path in a binary tree is a sequence of nodes such that: ...

April 20, 2026 · 13 min · map[name:Jeanphilo]