Malware Spread
Problem Overview
- Remove exactly one node from an undirected network to minimize total infections after malware spreads; return the node index (lowest index on ties).
- Inputs: g_nodes, edges via g_from/g_to, and a binary malware array; Output: int index of the node to remove.
- Constraints: up to 10^3 nodes and edges; nodes are 1-indexed; infection propagates to connected clean nodes until no new cases.
- Domain: prototype service for malware spread control; from Flexport interviews; a coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
