C++ || Easy & Simple Solution || DFS
\nclass Solution {\npublic:\n    int pathSum(TreeNode* root, int sum) {\n        \n        if(root == nullptr){return 0;}\n        return  pathSum(root->left, s
```\nclass Solution {\npublic:\n    int pathSum(TreeNode* root, int sum) {\n        \n        if(root == nullptr){return 0;}\n        return  pathSum(root->left, sum) + pathSum(root->right, sum) + dfs(root, sum);          \n    }\n    \n    int dfs(TreeNode* root, int sum)\n    {\n        if(root == nullptr){return 0;}\n        \n        int count = 0;\n        if(root->val == sum){ ++count;}\n        count += dfs(root->left, sum-root->val);\n        count += dfs(root->right, sum-root->val);\n        return count;\n    }\n};\n```\nDo upvote if it helped :)
['Depth-First Search', 'C', 'C++']