Path Sum III   JAVA
\nclass Solution {\n\n    public int pathSum(TreeNode root, int sum) {\n        if( root == null ) return 0;\n        return dfs(root,sum) + pathSum(root.left,s
```\nclass Solution {\n\n    public int pathSum(TreeNode root, int sum) {\n        if( root == null ) return 0;\n        return dfs(root,sum) + pathSum(root.left,sum) + pathSum(root.right,sum);\n    }\n\t\n    static int dfs(TreeNode root,int sum){\n        if( root == null ) return 0;\n        int ans = 0;\n\t\tsum -= root.val;\n        if( sum == 0 ) ans++;\n        ans += dfs(root.left,sum);\n        ans += dfs(root.right,sum);\n        return ans;\n    }\n\t\n}\n```
[]