Search
⌘K

Leetcode 928. Minimize Malware Spread II

Given an undirected graph and a set of initially infected nodes, remove exactly one initial node to minimize the final number of infected nodes after infection spreads across connected components. Reduce to finding connected components and choosing the initial node that is the unique infected in its component and thus saves the largest component (tie-break by smallest index), or the smallest-index initial if none qualifies.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.