✅Easy C++ Code || DFS🚀 || Recursion 🔥
\nclass Solution {\nint pairs = 0;\nprivate:\n    void helpmeValid(TreeNode* root, int &sum ,int &count)\n    {\n        if (root == NULL)   return ;\n        T
```\nclass Solution {\nint pairs = 0;\nprivate:\n    void helpmeValid(TreeNode* root, int &sum ,int &count)\n    {\n        if (root == NULL)   return ;\n        TreeNode* node = root;\n        \n        sum = sum + node->val;\n        count += 1;\n\n        helpmeValid(node->left, sum, count);\n        helpmeValid(node->right, sum , count);\n    }\n    void helpmePairs(TreeNode* root)\n    {\n        if (root == NULL)   return;\n        int sum = 0;\n        int count = 0;\n        \n        helpmeValid(root, sum , count);\n        if (root->val == sum / count)   pairs += 1;\n        \n        helpmePairs(root->left);    \n        helpmePairs(root->right);\n    }\npublic:\n    int averageOfSubtree(TreeNode* root)\n    {\n        helpmePairs(root);\n        return pairs;\n    }\n};\n```
['Math', 'Depth-First Search', 'Recursion', 'C++']