@@ -0,0 +1,1029 @@
+package leetcode;%0A%0A/**%0A * https://oj.leetcode.com/problems/path-sum/%0A */%0Apublic class Problem112 %7B%0A    public static class TreeNode %7B%0A        int val;%0A        TreeNode left;%0A        TreeNode right;%0A%0A        TreeNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A%0A    public boolean hasPathSum(TreeNode root, int sum) %7B%0A        if (root == null) %7B%0A            return false;%0A        %7D%0A        return hasPathSum(root, sum, 0, !(root.left != null %7C%7C root.right != null));%0A    %7D%0A    %0A    private boolean hasPathSum(TreeNode node, int sum, int accu, boolean isLeaf) %7B%0A        if (node == null) %7B%0A            if (accu == sum && isLeaf) %7B%0A                return true;%0A            %7D else %7B%0A                return false;%0A            %7D%0A        %7D%0A        boolean found1 = hasPathSum(node.left, sum, accu + node.val,%0A            !(node.left != null %7C%7C node.right != null));%0A        boolean found2 = hasPathSum(node.right, sum, accu + node.val,%0A            !(node.left != null %7C%7C node.right != null));%0A        return found1 %7C%7C found2;%0A    %7D%0A%7D%0A

Solve problem 112