c#  post-order dfs 100% 100%
\npublic class Solution {\n    \n    int dfs(int[,] leaves, int[,] nums, int node)\n    {\n        int left = leaves[node, 0] == -1? 0: dfs(leaves, nums, leaves
```\npublic class Solution {\n    \n    int dfs(int[,] leaves, int[,] nums, int node)\n    {\n        int left = leaves[node, 0] == -1? 0: dfs(leaves, nums, leaves[node, 0]);\n        int right = leaves[node, 1] == -1? 0: dfs(leaves, nums, leaves[node, 1]);\n        nums[node, 0] = left;\n        nums[node, 1] = right;\n        return left + right + 1;\n    }\n    \n    public int CountHighestScoreNodes(int[] parents) {\n        int len = parents.Length;\n        if (len < 2)\n            return 0;\n        \n        int root = 0;\n        int[,] nums= new int[len,2];\n        int[,] leaves = new int[len, 2];\n        \n        for (int i = 0; i < len; i++){\n            leaves[i,0] = -1;\n            leaves[i,1] = -1;\n        }\n        \n        for (int i = 0; i < len; i++){\n            if (parents[i] == -1){\n                root = i;\n                continue;\n            }\n                \n            if (leaves[parents[i], 0] == -1)\n                leaves[parents[i], 0] = i;\n            else\n                leaves[parents[i], 1] = i;\n        }\n        \n        dfs (leaves, nums, root);\n        \n        int result = 0;\n        long max = 0;\n        for (int i = 0; i < len; i++)\n        {\n            long left = nums[i,0];\n            long right = nums[i,1];\n            long rest = len - left - right - 1 == 0? 1 : len - left - right - 1;\n            if (left == 0)\n                left = 1;\n            if (right == 0)\n                right = 1;\n            \n            long p = left * right * rest;\n            \n            if (p > max){\n                max = p;\n                result = 1;\n            }else if (p == max){\n                result += 1;\n            }\n        }\n        return result;\n    }\n}\n```\n
['Depth-First Search']