c++ solution using DFS ✔
\nclass Solution {\npublic:\n    int ans=0;\n    \n    void dfs(TreeNode* root,long long tar){\n        if(!root) return ;\n        \n        if(root->val== tar
```\nclass Solution {\npublic:\n    int ans=0;\n    \n    void dfs(TreeNode* root,long long tar){\n        if(!root) return ;\n        \n        if(root->val== tar)ans++;\n        dfs(root->left, tar-(root->val));\n        dfs(root->right,tar-(root->val));\n    }\n    \n    \n    int pathSum(TreeNode* root, int tar) {\n        if(!root)return 0;\n        \n        dfs(root,tar);\n        pathSum(root->left, tar);\n        pathSum(root->right,tar);\n        \n        return ans;\n    }\n};\n```
['Depth-First Search', 'Recursion', 'C', 'C++']