Back to problems

Lowest Common Manager in an Org Chart (Binary-Tree LCA Family)

Algorithm · Amazon · Medium

You are given an organization hierarchy in which every employee other than the root has exactly one manager, along with the names of two employees. Find the closest manager that sits above both of them in the hierarchy, that is, the lowest manager both employees ultimately report to. If one of the two employees manages the other, that employee is itself the answer. Follow-ups Instead of two employees, the input becomes a list containing many employees. Return the lowest…

Loading the rest of the question…