y***n 发帖数: 1594 | 1 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.
看了一下这个,好像不太对。 http://hawstein.com/posts/4.8.html |
m*****n 发帖数: 2152 | 2 解法2,对。但是好像内存管理有问题,要copy多少次vector啊?
用reference要好一点。 |
l*********8 发帖数: 4642 | 3 1
/ \
2 3
2-1-3不算一条路径吗? 题解里都没有考虑 |
a**********0 发帖数: 422 | 4 我觉得他们似乎不做题 这个是leetcode的原题 你说的算一个path
就是递归做
【在 l*********8 的大作中提到】 : 1 : / \ : 2 3 : 2-1-3不算一条路径吗? 题解里都没有考虑
|
y***n 发帖数: 1594 | 5 leetCode 的那个题是这样的,我看不出来. |
a**********0 发帖数: 422 | 6 原题是求最大的好像 但是每次如果找到 就加到arraylist里边 和原题差别也不大啊
【在 y***n 的大作中提到】 : leetCode 的那个题是这样的,我看不出来.
|
y***n 发帖数: 1594 | 7 我的能力就是不能把题转换成相似的题。
原来学文科的,差了一点。。 |
y***n 发帖数: 1594 | |