Problem
Given a binary tree, find the maximum path sum. A path is any sequence of nodes where each pair of adjacent nodes has an edge. The path does not need to pass through the root.
References
Difficulty
🔴 Hard
Companies
Microsoft, Facebook, Morgan Stanley
Notes
Language: Java
Track global max separately. Each recursive call returns max gain from that node going downward (not the split path).
Problem
Given a binary tree, find the maximum path sum. A path is any sequence of nodes where each pair of adjacent nodes has an edge. The path does not need to pass through the root.
References
Difficulty
🔴 Hard
Companies
Microsoft, Facebook, Morgan Stanley
Notes
Language: Java
Track global max separately. Each recursive call returns max gain from that node going downward (not the split path).