← 返回 meta 的题目列表Modified Path Sum II
类型:online_judge
Given a binary tree and a target sum, find all root-to-leaf paths where each path's sum equals the given target sum. Return a list of paths, where each path is represented as a list of node values. If no such paths exist, return an empty list. Assume the tree may contain negative numbers. The number of nodes in the tree is in the range [0, 5000], and node values are between [-1000, 1000].
Example
Input
5
4
11
7
2
8
13
4
5
1
22