[Python] Simple DFS Solution with explanation
for each node, when we remove it, we have the following parts:\n1. child subtree if any\n2. parent subtree if any\n\nwe use dfs to count the number of node in e
for each node, when we remove it, we have the following parts:\n1. child subtree if any\n2. parent subtree if any\n\nwe use dfs to count the number of node in each child subtree (no.1) and calculate the number of node in the parent subtree by `N - sum(child_subtree) - 1(node itself)`. We use `memo` to aovid duplicated calculation in dfs.\n\n```python\n    def countHighestScoreNodes(self, parents: List[int]) -> int:\n        children = collections.defaultdict(list)\n        for i, par in enumerate(parents):\n            children[par].append(i)\n\n        @lru_cache(None)\n        def dfs(root):\n            count = 1\n            for child in children[root]:\n                count += dfs(child)\n            return count\n\n        N = len(parents)\n        max_score = 0\n        score_counter = collections.defaultdict(int)\n\n        for root in range(N):\n            child = children[root]\n            _sum = 0\n            score = 1\n\n            # score of the child tree\n            for c in child:\n                count = dfs(c)\n                score *= count\n                _sum += count\n\n            curr_score = score * max(1, N-_sum-1) # score of the parent subtree\n            score_counter[curr_score] += 1\n            max_score = max(max_score, curr_score)\n\n        return score_counter[max_score]\n```
['Depth-First Search', 'Python', 'Python3']