You are the VP of Engineering at a tech company, and you need to assemble an elite task force from your department to build a critical new product.
The department is organized in a strict top-down chain of command starting from a single Head of Engineering. To ensure focused leadership, no employee is allowed to directly manage more than two immediate subordinates. Each employee brings a unique, non-negative impact_score to the team based on their expertise.
You want to maximize the total impact_score of the assembled team, but you must strictly adhere to the following company policies:
Employees with one or zero direct reports do not incur the Key Manager penalty, and skipping them does not trigger a leadership vacuum.
Given the starting employee at the top of the organizational chart and an integer C, return the maximum possible effective impact_score your task force can achieve.
3
10 20 30
5
30
Node 10 has exactly two direct reports (20 and 30), making it a Key Manager. Option 1 (Include Node 10): Its score becomes (10 - 5) = 5. By Policy 1, we cannot include 20 or 30. Total = 5. Option 2 (Exclude Node 10): By Policy 3 (Leadership Vacuum), we can select at most one direct report. We choose 30. Total = 30.
Amazon • Pending
Rippling • Pending
Texas • Pending
Texas • Pending