← 返回 bloomberg 的题目列表Find the Path with the Minimum Sum in an N-ary Tree
类型:online_judge
Given an N-ary tree, find a path from the root node to a leaf node such that the sum of the node values along that path is minimum.
Input: The root node of the tree.
Output: A list of node values representing the path from root to a leaf node with the minimum sum of node values.
Example:
Input:
5
/ | \
3 2 4
/| \
2 1 3
Output: [5, 2, 3]
Example
Input
5
3 2 4
2 1
3