DFS  + node counting + freq | Easy
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def countHighestScoreNodes(self, parents: List[int]) -> int:
        n = len(parents)
        adj = defaultdict(list)
        for child, parent in enumerate(parents):
            if child == 0: continue
            adj[parent].append(child)

        occur = defaultdict(int)
        def dfs(node):
            if not node in adj: #leaf node
                occur[n-1] += 1
                return 1
            curr = 1
            size = 0
            for nei in adj[node]:
                res = dfs(nei)
                size += res
                curr *= max(1, res)
            curr *= max(1, n - size - 1)
            occur[curr] += 1

            return size + 1

        dfs(0)
        
        return occur[max(occur.keys())]

```
['Python3']