Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
50
:
46
Back to Dashboard
Org Chart Builder
Medium
A company has a list of employees. Each entry has three strings: [id, manager_id, name]. The CEO is the only employee whose manager_id equals their own id. All other employees report to exactly one manager.
Generate an org chart as a hierarchical text string. Each employee's name appears on its own line, followed by a newline character '\n'. The last employee has no trailing newline. Each level of the hierarchy adds four dashes '----' of indentation relative to the manager's level.
...