# Employee Importance (Leetcode 690)

Problem Link: <https://leetcode.com/problems/employee-importance/description/>

```
"""
# Definition for Employee.
class Employee:
    def __init__(self, id: int, importance: int, subordinates: List[int]):
        self.id = id
        self.importance = importance
        self.subordinates = subordinates
"""

class Solution:
    def getImportance(self, employees: List['Employee'], id: int) -> int:

        q=[]
        for i in employees:
            if(i.id==id):
                q.insert(0,i)
                break
        ans=0
        while(q):
            currObj=q.pop()
            currId,currImp,currSub=currObj.id,currObj.importance,currObj.subordinates
            ans=ans+currImp
            for adj in currSub:
                for i in employees:
                    if(adj==i.id):
                        q.insert(0,i)
                        break
        return ans
```
