python - kill process

  • 0
    class Solution(object):
        def killProcess(self, pid, ppid, kill):
            :type pid: List[int]
            :type ppid: List[int]
            :type kill: int
            :rtype: List[int]
            sched_tree = {}
            for i,parent in enumerate(ppid):
                if parent not in sched_tree:
                    sched_tree[parent] = []
            queue = [kill]
            answer = []
            while queue:
                curr = queue.pop(0)
                if curr in sched_tree:
                    queue += sched_tree[curr]
            return answer

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.