Back to problems

Org-Chart Salary Aggregation

Algorithm · Amazon · Medium

Requirements You receive a list of employee records, each an object with an id, numeric salary, and manager_id (another employee's id or null for no manager): Part 1: identify the manager whose team members have the greatest mean salary. Part 2: given a particular manager, determine the mean salary among all direct and indirect reports in that manager's subtree — the intended direction is to represent the reporting structure as a tree instead of relying on one flat grouping…

Checking your access…