Grokking Graph Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Time Needed to Inform All Employees (medium)
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

A company has n employees, each with a unique ID from 0 to n-1. The head of the company has an ID headID.

Each employee has a direct manager, indicated by the manager array, where manager[i] is the direct manager of the i<sup>th</sup> employee. The head of the company has no manager, so manager[headID] = -1.

The company needs to inform all employees about urgent news. The head will inform their direct subordinates, who will then inform their subordinates, and so on. Each employee i needs informTime[i] minutes to inform all their direct subordinates

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible