public Boolean hasPathSum(TreeNode root, int sum){
        if(root.value==sum){
            return true;
        }
        if(root.value>sum){
           return hasPathSum(root.left, sum) || hasPathSum(root.right, sum);
        }
        if(root.value<sum){
           return hasPathSum(root.left, sum - root.value) || hasPathSum(root.right,
                   sum - root.value) || hasPathSum(root.left, sum) ||
               hasPathSum(root.right, sum);
        }
        return false;
    }