You are given a company hierarchy as a tree. Each node represents an employee. Node is the CEO. Edges represent direct reporting relationships. For each employee, count how many subordinates they have. A subordinate is anyone in their subtree, excluding the employee themselves.
This is a direct application of subtree size computation. If you can count nodes in a subtree, you can solve this. Compute sizes, then subtract one for each node.