Show every employee's path to the top
HR asked for a visual «path» from every employee up to the CEO as a string with arrows — e.g. «Anna → VP-Eng → CEO». A clean way to surface org depth. For every employee show their id, name, and the joined chain of names from themselves up to the top of the hierarchy. Sort by id. You'll need a recursive walk over the reporting tree.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| id | name | chain |
|---|---|---|
| 1 | CEO | CEO |
| 2 | VP-Eng | VP-Eng → CEO |
| 3 | VP-Sales | VP-Sales → CEO |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in