Easy solution using C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n- Post order traversal\
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Post order traversal\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    int count = 0;\n    int countNodeValue(TreeNode* root)\n    {\n        if (!root) return 0;\n        return root->val + countNodeValue(root->left) + countNodeValue(root->right);\n    }\n    int countNode(TreeNode* root)\n    {\n        if (!root) return 0;\n        return 1 + countNode(root->left) + countNode(root->right);\n    }\n    void NLR(TreeNode* root)\n    {\n        if (!root) return;\n        if (floor(countNodeValue(root) / countNode(root)) == root->val) count++;\n        NLR(root->left);\n        NLR(root->right);\n    }\n    int averageOfSubtree(TreeNode* root) {\n        // if (!root) return 0;\n        // int sum = root->val + countNodeValue(root->left) + countNodeValue(root->right);\n        // int nodes = 1 + countNode(root->left) + countNode(root->right);\n        // int avg = floor(sum / nodes);\n        // if (avg == root->val) return 1 + averageOfSubtree(root->left) + averageOfSubtree(root->right);\n        // return averageOfSubtree(root->left) + averageOfSubtree(root->right);\n        NLR(root);\n        return count;\n    }\n};\n\n```
['C++']