Simple C++ Solution || (Using DFS) ✅✅
Code\n\nclass Solution {\npublic:\n    map<long long,int> mp;\n    int dfs(vector<int> adj[],int node,int n){\n        int ans=0;\n        int i=0;\n        int
# Code\n```\nclass Solution {\npublic:\n    map<long long,int> mp;\n    int dfs(vector<int> adj[],int node,int n){\n        int ans=0;\n        int i=0;\n        int sum1=0;\n        int sum2=0;\n        for(int a:adj[node]){\n            if(i==0){\n                sum1=(1+dfs(adj,a,n));\n            }else{\n                sum2=(1+dfs(adj,a,n));\n            }\n            i++;\n        }\n        mp[(long long)max(1,sum1)*max(1,sum2)*max(1,(n-1-sum1-sum2))]++;\n        return sum1+sum2;\n    }\n    int countHighestScoreNodes(vector<int>& parents) {\n        int n=parents.size();\n        vector<int> adj[n];\n        for(int i=0;i<n;i++){\n            if(parents[i]==-1)  continue;\n            adj[parents[i]].push_back(i);\n        }\n        dfs(adj,0,n);\n        int ans=mp.rbegin()->second;\n        return ans;\n    }\n};\n```
['Depth-First Search', 'Binary Tree', 'C++']