###### leetcode Path Sum II

/**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public List<List<Integer>> pathSum(TreeNode root, int sum) {

help(root, sum, 0, result, tempResult);
return result;
}

public void help(TreeNode root,int sum,int currentsum,List<List<Integer> >result,List<Integer> tempResult)
{
if(root==null)
{
return;
}
currentsum+=root.val;
if(root.left==null&&root.right==null)
{
if(currentsum==sum)
{
}

}

if(root.left!=null)
{
help(root.left, sum, currentsum, result, tempResult);
}
if(root.right!=null)
{
help(root.right, sum, currentsum, result, tempResult);
}

tempResult.remove(tempResult.size()-1);
return;
}
}

#### Path Sum II -- LeetCode

2014-04-14 23:59:49

#### 【leetcode c++】113 Path Sum II

2015-08-01 00:06:17

#### 【LeetCode-面试算法经典-Java实现】【113-Path Sum II（路径和）】

2015-08-12 06:23:36

#### 【LeetCode】113. Path Sum II 基于Java和C++的解法及分析

2016-05-09 22:25:36

#### leetcode 113. Path Sum II-路径和|回溯算法

2016-06-11 15:35:35

#### 【leetCode】Path Sum II python实现

2016-06-18 21:54:06

#### 【LeetCode with Python】 Path Sum II

2014-06-27 18:02:30

#### leetcode_c++:树: Path SumII（113）

2016-08-25 16:48:12

#### LeetCode详解 之 Path Sum I and II(Java)

2015-05-24 00:55:29

#### LeetCode 113. Path Sum II（路径和）

2016-05-24 00:19:11

## 不良信息举报

leetcode Path Sum II