A path visits connected nodes and sums their values. It can start and end anywhere, and it bends at most once. In this tree, what's the maximum sum any connected path can achieve?
Given a binary tree where each node holds an integer (positive, negative, or zero), find the maximum sum of any non-empty path -- where a “path” is a sequence of connected nodes that starts and ends anywhere and bends at most once.
The optimal path can avoid the root entirely AND can include negative branches via clamping decisions -- and a “path” cannot fork twice, which means a node returns ONE side to its parent but considers BOTH sides for the global tracker.
Tap two nodes below. We'll compute the sum of the path between them. Can you find the maximum?