You are given a network of graph, where graph[i][j] = 1 indicates a direct connection between node i and node j, and graph[i][j] = 0 indicates no connection.
You are also given an array initial containing the nodes initially infected with malware. When two nodes are directly connected and at least one of them is infected, the malware spreads to the other node. This infection process continues until no additional nodes can be infected.
Suppose
You must remove exactly one node from initial, completely removing that node and all edges connected to it from the network.
Return the node that should be removed to minimize
Constraints:
n graph.length
n graph[i].length
n
graph[i][j] is
graph[i][j] graph[j][i]
graph[i][i]
initial.length
initial[i]
All the integers in initial are unique.
You are given a network of graph, where graph[i][j] = 1 indicates a direct connection between node i and node j, and graph[i][j] = 0 indicates no connection.
You are also given an array initial containing the nodes initially infected with malware. When two nodes are directly connected and at least one of them is infected, the malware spreads to the other node. This infection process continues until no additional nodes can be infected.
Suppose
You must remove exactly one node from initial, completely removing that node and all edges connected to it from the network.
Return the node that should be removed to minimize
Constraints:
n graph.length
n graph[i].length
n
graph[i][j] is
graph[i][j] graph[j][i]
graph[i][i]
initial.length
initial[i]
All the integers in initial are unique.