Discover Packages
github.com/mogu-echo/go-algorithm/Algorithms
0124.binary-tree-maximum-path-sum
package
Version:
v0.0.0-...-b5790eb
Opens a new window with list of versions in this module.
Published: Oct 20, 2020
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
题目
Given a binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must contain at least one node and does not need to go through the root.
For example:
Given the below binary tree,
1
/ \
2 3
Return 6.
解题思路
见程序注释
Expand ▾
Collapse ▴
Documentation
¶
type ResultType struct {
SinglePath, MaxPath int
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.