Back to all patterns

Tree DFS with Global Max

1 problems • Practice on LeetCode to earn credits

About This Pattern

Master the Tree DFS with Global Max pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Hard (1)

Binary Tree Maximum Path Sum

Find the maximum path sum in a binary tree (path can start and end anywhere).

Key Signals:

Calculate max gain from each subtreeUpdate global maxReturn max path through node