第四版的4.8:
You are given a binary tree in which each node contains a value. Design an
algorithm to print all paths which sum up to that value. Note that it can be
any path in the tree - it does not have to start at the root.
书上的解法貌似只考虑root左边或者右边subtree里的path,比如下面这个找sum=6的就
找不出来,
2
1 3
想确认一下我的理解对不对。如果需要考虑这种情况有什么简洁点的做法?