Short Python DFS solution w/ short explanation ~290 ms
For previous version, Minimize Malware Spread I, check my solution https://leetcode.com/problems/minimize-malware-spread/discuss/181723/Python-short-DFS-solutio
* For previous version, **Minimize Malware Spread I**, check my solution [https://leetcode.com/problems/minimize-malware-spread/discuss/181723/Python-short-DFS-solution](http://)\n*  Question is simply asking minimum indexed node in **initial** array with following feature:\n\t* node will have maximum **impact** out of nodes in **initial** array, which means:\n\t\t* having maximum amount of **non-initial** nodes that can only be visited by this unique node\n* Now we know what we are aiming for, rest is donkey work.\n\t* We check the **impact** of every node in **initial** array in sorted order\n\t* If it has bigger **impact** than current maximum **impact** (**mx**), then we update **mx** and **res** (returning node).\n\t* For checking **impact**, we accumulate what we can get from node\'s each neighbor.\n\t\t* If a neighbor cannot connect another **initial** node, then this neighbor only accesible through current **initial** node and we add those seen nodes to **impact** for current **initial** node.\n```\nclass Solution:\n    def minMalwareSpread(self, graph, initial):\n        def dfs(i):\n            seen.add(i)\n            return not any(graph[i][j] and j not in seen and (j in initials or not dfs(j)) for j in range(len(graph[i])))\n        res, mx, initials = min(initial), 1, set(initial)\n        for node in sorted(initial):\n            impact = set()\n            for j in range(len(graph[node])):\n                seen = {node}\n                if graph[node][j] and j not in initials and dfs(j): impact |= seen\n            if len(impact) > mx: res, mx = node, len(impact)\n        return res\n```
[]