Path Sum IV

Give a binary tree, and a target number, find all path that the sum of nodes equal to target, the path could be start and end at any node in the tree.

Example

Given binary tree:

    1
   / \
  2   3
 /
4

and target =6. Return :

[
  [2, 4],
  [2, 1, 3],
  [3, 1, 2],
  [4, 2]
]

Note

可以拐弯了,但是最多拐一次。

Last updated