DIY: Time Needed to Inform All Employees
Understand how to model company hierarchies as trees and calculate the total time required to spread an urgent message from the head to all employees. This lesson helps you implement efficient solutions to simulate network-style information transmission and solve related coding interview problems.
We'll cover the following...
We'll cover the following...
Problem statement
A company has n employees, and each employee has a unique ID from 0 to n - 1. The ID of the head of the company is head_id.
Each employee has one direct manager given in the manager array. In the manager array, manager[i] is the direct manager of the i-th employee, ...