🚀🚀C++ Easy to understand solution ✨🚀🚀
I have made 2 extra function apart from main fxn\n1. to get the average of an subtree by passing root\n2. to get the number of nodes who have avg value = their 
**I have made 2 extra function apart from main fxn**\n1. to get the average of an subtree by passing root\n2. to get the number of nodes who have avg value = their root value \n```\n\nclass Solution {\npublic:\n    void avgof(TreeNode* root, int &sum, int &cnt){\n        if(root == NULL) {\n            return;\n        }\n        sum = sum + root->val;\n        cnt++;\n        avgof(root->left, sum, cnt);\n        avgof(root->right, sum, cnt);\n        \n    }\n    void task(TreeNode* root,int &sum, int &cnt, int &ans ){\n        if(root == NULL)return;\n        sum =0;\n        cnt =0;;\n        avgof(root, sum, cnt);\n        int k = sum / cnt;\n        if(k == root->val)ans++; \n        task(root->left, sum, cnt, ans);\n        task(root->right, sum, cnt, ans);\n\n    }\n    int averageOfSubtree(TreeNode* root) {\n        int sum, cnt, ans = 0;\n        task(root, sum, cnt, ans);\n        return ans;\n        \n    }\n};
['Tree']