Algorithm · C3.ai · Medium
The input is a flat, unordered list of employees. Each entry identifies one employee along with the name of that employee's manager. Using this list, build whatever you need to answer the following queries about the organization's reporting structure: Given a manager, return every employee who sits anywhere beneath that manager in the hierarchy. Given a manager, return only those employees beneath that manager who do not manage anyone themselves. Given a manager, return only…