Company: Agoda_25july
Difficulty: medium
Malware Spread Control Problem Description Implement a prototype service for malware spread control in a network. There are g_nodes servers in a network and g_edges connections between its nodes. The i th bidirectional connection connects g_from[i] and g_to[i] . Some of the nodes are infected with malware. They are listed in the array malware , where if malware[i] = 1 node i is infected, and if malware[i] = 0 , node i is not infected. Any infected node infects other non-infected nodes, which are directly connected. This process goes on until no new infected nodes are possible. Exactly 1 node can be removed from the network. Return the index of the node to remove such that the total infected nodes in the remaining network are minimized. If multiple nodes lead to the same minimum result, then return the one with the lowest index. Examples Example 1: Input: g_nodes = 9, g_edges = 5, g_from = [1, 2, 4, 6, 7], g_to = [2, 3, 5, 7, 8], malware = [0, 0, 1, 0, 1, 0, 0, 0, 0] Output: 3 Explanati