Naive but easy to understand | Only faster than 55%
\nclass Solution {\n    int count = 0;\n    public int pathSum(TreeNode root, int sum) {\n        helper(root,sum);\n        return count;\n    }\n    \n    pri
```\nclass Solution {\n    int count = 0;\n    public int pathSum(TreeNode root, int sum) {\n        helper(root,sum);\n        return count;\n    }\n    \n    private void helper(TreeNode root,int sum){\n        if(root == null)return;\n        dfs(root,sum,0);\n        helper(root.left,sum);\n        helper(root.right,sum);\n    }\n    \n    private void dfs(TreeNode root , int target,int sum){\n        if(root == null)return;\n        if(root.val + sum == target){\n            count++;\n        }\n        dfs(root.left,target,sum + root.val);\n        dfs(root.right,target,sum+root.val);\n    }\n    \n}\n```
['Java']