[C++] simple dfs solution (T:88.41%, M:100%)
\nclass Solution {\npublic:\n    int pathcount;\n    void getsum(TreeNode* root, int sum){//checking paths at each node.\n        if(!root)return;\n        if(r
```\nclass Solution {\npublic:\n    int pathcount;\n    void getsum(TreeNode* root, int sum){//checking paths at each node.\n        if(!root)return;\n        if(root->val==sum){\n            pathcount++;\n        }\n        getsum(root->left,sum-root->val);\n        getsum(root->right,sum-root->val);\n    }\n    int pathSum(TreeNode* root, int& sum) {//perform simple dfs checking for each node\n        if(root){\n            getsum(root,sum);\n            pathSum(root->left,sum);\n            pathSum(root->right,sum);\n        }\n        return pathcount;\n    }\n};\n```
['Depth-First Search', 'Recursion', 'C', 'C++']