0690. Employee Importance
https://leetcode.com/problems/employee-importance
Description
You have a data structure of employee information, which includes the employee's unique id, their importance value, and their direct subordinates' id.
You are given an array of employees employees where:
employees[i].idis the ID of theithemployee.employees[i].importanceis the importance value of theithemployee.employees[i].subordinatesis a list of the IDs of the subordinates of theithemployee.
Given an integer id that represents the ID of an employee, return the total importance value of this employee and all their subordinates.
Example 1:

Example 2:

Constraints:
1 <= employees.length <= 20001 <= employees[i].id <= 2000All
employees[i].idare unique.-100 <= employees[i].importance <= 100One employee has at most one direct leader and may have several subordinates.
idis guaranteed to be a valid employee id.
ac
Last updated
Was this helpful?