Solved LeetCode program · 998 of 1,000
#1376 · Time Needed to Inform All Employees
Original English source
Keep a shared manager holding 2, 2, -1, 2, 2, and 2. Keep a shared informTime holding 0, 0, 1, 0, 0, and 0. Keep a shared total of 0. Keep a shared best of 0.
To measure from employee (a whole number). Set total to 0. The current is employee.
Repeat while item current of manager is not -1.
The boss is item current of manager. Increase total by item boss of informTime. Set current to boss.
For every employee from 0 to 5.
Measure from employee. If total is more than best, set best to total.
Show best.
Expected stdout
1