Return one, record one
transcript
A tree holds a number in every single node. Your task is to find the path with the largest sum. A path may bend once, at a node. Here is how one pass does it.
Each call returns the better chain going down, to its parent. It records the bend that uses both children. The answer is the best record anywhere.
Start at the leaves, fifteen and seven. At twenty, the bend adds up to forty-two. The call returns only thirty-five. At the root, the bend gives thirty-four. The best record anywhere is forty-two, not thirty-five.
The parent can extend only one chain. The bend uses both children at once.
A chain with a negative sum only makes a path worse. So count a negative chain as zero, and skip it. The node itself always stays in the path.
Return the better chain. Record the bend with both children. Full breakdown in the lecture.