This is a verified interview question from Rippling. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Malware Spread Control - Rippling OA" covers key patterns like Graphs.
"Implement a prototype service for malware spread control in a network. There are g_nodes servers in a network and g_edges connections between them. The i-th bidirectional connection joins nodes g_from[i] and g_to[i]. Some nodes are initially infected with malware, represented by the array malware, where malware[i] = 1 if node i is infected and 0 otherwise. An infected node infects all directly connected uninfected nodes. The process continues until no further infections are possible. Exactly one node may be removed from the network (along with all its incident edges). Return the index of the node whose removal minimizes the total number of infected nodes after the infection process terminates. If multiple nodes achieve the same minimum, return the smallest index among them."
Join thousands of developers practicing for Rippling.