C++ easy recursive solution
See more in my GitHub repo LeetCode.\n\nRecuirsive Solution\nWe will use pair,avg> to store ans...And keep a count\nFor any node with avg == root->val count++\n
See more in my GitHub repo [LeetCode](http://github.com/SahilK-027/LeetCode).\n\n**Recuirsive Solution**\nWe will use pair<pair<sum,number>,avg> to store ans...And keep a count\nFor any node with avg == root->val count++\n```\nclass Solution {\nprivate:\n    pair<pair<int,int>,int> solve(TreeNode* root, int& count){\n        //Base case\n        if(root == NULL){\n            pair<int,int> a = make_pair(0,0);\n            pair<pair<int,int>,int> p = make_pair(a,0);\n            return p;\n        }\n        // Recursive Call\n        pair<pair<int,int>,int> leftAns = solve(root->left,count);\n        pair<pair<int,int>,int> rightAns = solve(root->right,count);\n        \n        int sum = leftAns.first.first + rightAns.first.first + root->val;\n        int n = 1 + leftAns.first.second + rightAns.first.second;\n        int avg = sum / n;\n        if(avg == root->val){\n            count = count+1;\n        }\n        \n        pair<pair<int,int>,int> ans;\n        ans.first.first = sum;\n        ans.first.second = n;\n        ans.second = avg;\n        return ans;\n        \n    }\npublic:\n    int averageOfSubtree(TreeNode* root) {\n        ios_base::sync_with_stdio(0);\n        cin.tie(0);\n        int count = 0; \n        pair<pair<int,int>,int> ans = solve(root,count);\n        return count;\n    }\n};\n```
['Recursion', 'C']