Skip to content

Commit 4cbe717

Browse files
refactor 582
1 parent 120618f commit 4cbe717

File tree

1 file changed

+0
-31
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-31
lines changed

src/main/java/com/fishercoder/solutions/_582.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,6 @@
77
import java.util.List;
88
import java.util.Map;
99

10-
/**
11-
* 582. Kill Process
12-
*
13-
* Given n processes, each process has a unique PID (process id) and its PPID (parent process id).
14-
15-
Each process only has one parent process, but may have one or more children processes. This is just like a tree structure. Only one process has PPID that is 0, which means this process has no parent process. All the PIDs will be distinct positive integers.
16-
17-
We use two list of integers to represent a list of processes, where the first list contains PID for each process and the second list contains the corresponding PPID.
18-
19-
Now given the two lists, and a PID representing a process you want to kill, return a list of PIDs of processes that will be killed in the end. You should assume that when a process is killed, all its children processes will be killed. No order is required for the final answer.
20-
21-
Example 1:
22-
Input:
23-
pid = [1, 3, 10, 5]
24-
ppid = [3, 0, 5, 3]
25-
kill = 5
26-
Output: [5,10]
27-
28-
Explanation:
29-
3
30-
/ \
31-
1 5
32-
/
33-
10
34-
35-
Kill 5 will also kill 10.
36-
37-
Note:
38-
The given kill id is guaranteed to be one of the given PIDs.
39-
n >= 1.
40-
*/
4110
public class _582 {
4211

4312
public static class Solution1 {

0 commit comments

Comments
 (0)