@@ -0,0 +1,627 @@
+// Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum = 22, 5 / %5C 4 8 / / %5C 11 13 4 / %5C %5C 7 2 1 return true, as there exist a root-to-leaf path 5-%3E4-%3E11-%3E2 which sum is 22.%0A%0Apublic class Solution %7B%0A    public boolean hasPathSum(TreeNode root, int sum) %7B%0A    %09if(root == null) return false;%0A%0A    %09if(root.left == null && root.right == null)%7B%0A    %09%09return sum == root.val;%0A    %09%7D%0A%0A    %09return hasPathSum(root.left, sum - root.val) %7C%7C hasPathSum(root.right, sum - root.val);%0A    %7D%0A%7D%0A

add path sum solution