y*******d 发帖数: 1674 | 2 just started leetcode practice.
has a question about #113:
public class Solution {
public List> pathSum(TreeNode root, int sum) {
List> all = new ArrayList();
findPathSum(root, sum, all, new ArrayList());
return all;
}
private void findPathSum(TreeNode node, int sum, List>
result, List l) {
if (node == null) {
return;
}
l.add(node.val);
if (node.left == null && n... 阅读全帖 |
|