@@ -0,0 +1,850 @@
+/**%0A * Definition for a binary tree node.%0A * public class TreeNode %7B%0A *     int val;%0A *     TreeNode left;%0A *     TreeNode right;%0A *     TreeNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Apublic class Solution %7B%0A    public boolean hasPathSum(TreeNode root, int sum) %7B%0A        if(root == null)%7B%0A            return false;%0A        %7Delse if(root.left == null && root.right == null)%7B%0A            if(root.val == sum)%7B%0A                return true;%0A            %7Delse%7B%0A                return false;%0A            %7D%0A        %7Delse if(root.left == null && root.right != null)%7B%0A            return hasPathSum(root.right, sum-root.val);%0A        %7Delse if(root.left != null && root.right == null)%7B%0A            return hasPathSum(root.left, sum-root.val);%0A        %7Delse%7B%0A            return hasPathSum(root.left, sum-root.val) %7C%7C hasPathSum(root.right, sum-root.val);%0A        %7D%0A    %7D%0A%7D

Q112 Path Sum