124. Binary Tree Maximum Path Sum
Solutions
Comparison is needed when:
- Decide if we should update current maximum path sum.
- Decide left or right child can be part of the maximum path.
- Keep a global variable to keep track of current maximum path sum.
- Helper function returns maximum path sum of left / right child + current val.
Acting as a possible sub-path of the current maximum path.
PREVIOUSCourse Schedule