Count Levels

Problem Overview

  • Count the number of hierarchy levels between two employees in an organization, even if they are not in a direct managerial line.
  • Input: first line has two names to compare; subsequent lines list employee/manager pairs covering the complete hierarchy; constraints: N/A. Output: an integer count of levels between the two names.
  • Real-world context: helps track organizational change and promotions across the company.
  • From Blackrock interviews; a practical coding interview and interview question problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: