Back to problems

Print Employee Org Chart

Algorithm · Snapchat · Medium

Problem You are given a company's employee roster. Each entry in the roster is a triplet of strings: the employee's unique identifier, the unique identifier of their direct manager, and the employee's name. The company has exactly one CEO, who is the only person whose manager ID is the same as their own ID. Produce the organisation chart as a hierarchical text string. The string must list each employee's name on its own line, with a newline character ('\n') separating every…

Checking your access…