Python Easy Recursive Solution
Code\n\nclass Solution:\n    def countHighestScoreNodes(self, parents: List[int]) -> int:\n\n        sizes = [[0]*2 for _ in range(len(parents))]\n        dic =
## Code\n```\nclass Solution:\n    def countHighestScoreNodes(self, parents: List[int]) -> int:\n\n        sizes = [[0]*2 for _ in range(len(parents))]\n        dic = defaultdict(list)\n\n        def rec(root):\n\n            if not dic[root]:\n                return 1\n\n            if len(dic[root]) == 1:\n                sizes[root][0] = rec(dic[root][0])\n            elif len(dic[root]) == 2:\n                sizes[root][0] = rec(dic[root][0])\n                sizes[root][1] = rec(dic[root][1])\n\n            return 1 + sizes[root][0] + sizes[root][1]\n\n        for i in range(1,len(parents)):\n            dic[parents[i]].append(i)\n\n        total = rec(0)\n\n        res = []\n        for x,y in sizes:\n            res.append(max(x,1) * max(y,1) * max(total-x-y-1,1))\n\n        return res.count(max(res))\n\n```
['Python3']