Rippling | Sr SDE | May 2022
Anonymous User
3826

// Company xyz.com has an organizational structure such that each employee in the company can
// have at most one manager and may have many subordinates. The company recently conducted
// their quarterly performance review cycle and each employee has received a performance rating.

// An example structure is as follows

// A(5)

// B(3) C(2)

// D(4) E(10)

// Where employee A has rating 5 and direct subordinates B, C.
// Employee B has rating 3 and no direct subordinates.
// Employee C has rating 2 and two direct subordinates D, E each with rating 4 and 10 respectively.
// Note that although employee D is also a subordinate of employee A, the relationship is not direct.

// Level 0 - Employee data structure

// Provide a data structure for Employee that uniquely identifies the employee,
// their relation with manager and subordinates and has their performance rating.

// Level 1 - Best performing team

// Now given the employee information of a company, return the employee whose team
// has the highest performance rating average (mean). A team is defined as a group consisting
// of an employee and all their subordinates (not just the direct ones).

// Expected output: E (10)

// Example Input (pseudocode): [
// [A, 5, [B, C]],
// [B, 3, []],
// [C, 2, [D, E]],
// [D, 4, []],
// [E, 10, []]
// ]

Comments (3)