Created
March 31, 2016 15:11
-
-
Save danmux/fc03e7d390ad7e1d05c5163f228c98b4 to your computer and use it in GitHub Desktop.
Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Live Coding Task 2
In Centralway everyone has a boss apart from the CEO (although technically he probably has to answer to investors…): you, your boss, boss of your boss, and so on.
From our internal documentation, you can understand only who is the direct manager of who. We need your help to recreate the whole company hierarchy using this information. There are two letters in each document: 1st one – the manager, 2nd one – an employee.
Task
Each line of the input is a separate test case. It includes a list of all relationships in the company.
Result/output should be a string representation of the company hierarchy
What if there are multiple people at the top of the company hierarchy, for example multiple Managing Partners?
Examples
Input:
ab | ae | bc
ab | bc | cd | ae | cx | xz
Output:
a [b [c], e]
a [b [c [d, x [z]]], e]