Back to problems

Binary Tree Maximum Path Sum (with path reconstruction)

Algorithm · ByteDance · Hard

Examples The input is the tree in level-order (null marks a missing child) and the expected output is the node values along an optimal path, in traversal order — the reconstruction form described under "Reported extensions" below, not the sum alone. Example 1 Example 2 Requirements You are given a binary-tree root whose node values can be below zero. Determine the largest sum obtainable from a path. The route may begin and finish at any pair of nodes, can turn through no…

Checking your access…