Easiest to Understand Java solution
\n    public int pathSum(TreeNode root, int sum) {\n        int curCount = isMeetSum(root, sum);\n        if (root == null) {\n            return 0;\n        }\
```\n    public int pathSum(TreeNode root, int sum) {\n        int curCount = isMeetSum(root, sum);\n        if (root == null) {\n            return 0;\n        }\n\n        return curCount + pathSum(root.left, sum) + pathSum(root.right, sum);\n    }\n\n    public int isMeetSum(TreeNode root, int sum) {\n        if (root == null) {\n            return 0;\n        }\n        int count = 0;\n        if (root.val == sum) {\n            count++;\n        }\n        return count + isMeetSum(root.left, sum - root.val) + isMeetSum(root.right, sum - root.val);\n    }\n```\n\nThe `isMeetSum` method find the number of solutions that starting at the root, it doesn\'t matter where it ends. \nThe `pathSum` mehtod basically iterate to each node and add everything up. \n\nNot the best solution as it does a lot of repeated calcualtion.
['Java']