Java DFS easy understanding
\nclass Solution {\n    private int cnt;\n    \n    public int pathSum(TreeNode root, int sum) {\n        cnt = 0;\n        find(root, sum);\n        return cnt
```\nclass Solution {\n    private int cnt;\n    \n    public int pathSum(TreeNode root, int sum) {\n        cnt = 0;\n        find(root, sum);\n        return cnt;\n    }\n    \n    private void find(TreeNode root, int sum) {\n        if (root == null) return;\n        path(root, sum);\n        find(root.left, sum);\n        find(root.right, sum);\n    }\n    \n    private void path(TreeNode root, int sum) {\n        if (root == null) return;\n        if (sum - root.val == 0) cnt++;\n        path(root.left, sum - root.val);\n        path(root.right, sum - root.val);\n    }\n}\n```
['Depth-First Search', 'Java']