Skip to content

Commit 34da7e7

Browse files
[LEET-0000] clean up
1 parent d7c2dfc commit 34da7e7

File tree

1 file changed

+0
-35
lines changed
  • leetcode-algorithms/src/main/java/com/stevesun/solutions

1 file changed

+0
-35
lines changed

leetcode-algorithms/src/main/java/com/stevesun/solutions/PathSum.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,4 @@ public boolean hasPathSum(TreeNode root, int sum) {
2222
return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val);
2323
}
2424

25-
public static void main(String...strings){
26-
PathSum test = new PathSum();
27-
TreeNode root = new TreeNode(5);
28-
root.left = new TreeNode(4);
29-
int sum = 5;
30-
31-
// TreeNode root = new TreeNode(1);
32-
// root.left = new TreeNode(-2);
33-
// root.left.left = new TreeNode(1);
34-
// root.left.right = new TreeNode(3);
35-
// root.right = new TreeNode(-3);
36-
// root.right.left = new TreeNode(-2);
37-
// root.left.left.left = new TreeNode(-1);
38-
// int sum = 2;
39-
// 1
40-
// / \
41-
// -2 -3
42-
// / \ /
43-
// 1 3 -2
44-
// /
45-
// -1
46-
// System.out.println(test.hasPathSum(root, sum));
47-
System.out.println(test.hasPathSumAgain(root, sum));
48-
}
49-
50-
51-
public boolean hasPathSumAgain(TreeNode root, int sum) {
52-
if(root == null) return false;
53-
if(root.left == null && root.right == null){
54-
if(sum == root.val) return true;
55-
else return false;
56-
}
57-
return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val);
58-
}
59-
6025
}

0 commit comments

Comments
 (0)