今際の国の呵呵君
Sunday, October 28, 2018
[LeetCode]Minimize Malware Spread II
这道题Brute Force的做法就可以,我们依次把每个节点从initial list和图中移除,然后bfs看最后能够感染多少节点,取最少的就是答案。时间复杂度O((V + E) * N),V为节点数,E为边数,N为initial list的长度。代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment