import java
.util
.ArrayList;
import java
.util
.List;
public class _Test_25_2 {
ArrayList
<ArrayList
<Integer>> arrayListall
= new ArrayList
<ArrayList
<Integer>>();
ArrayList
<Integer> arrayList
= new ArrayList
<Integer>();
private ArrayList
<ArrayList
<Integer>> findPath(TreeNode root,int target) {
if (root
== null) {
return arrayListall;
}
arrayList
.add(root
.val);
target
-= root
.val;
if (target
== 0 && root
.left
== null && root
.right
== null) {
arrayListall
.add(
new ArrayList
<Integer>(arrayList));
}
if(root
.left
!=null) findPath(root
.left, target);
if(root
.right
!=null) findPath(root
.right, target);
arrayListall
.remove(arrayList
.size()
- 1);
return arrayListall;
}
}