[C++] The solution is errornous - doesn't cover case if removed node is not initially infected.
The proposed solution doesn\'t cover the case if a node is removed, which is not initially infected.\nIt can be that it is a bridge to parts of the graph, which
The proposed solution doesn\'t cover the case if a node is removed, which is not initially infected.\nIt can be that it is a bridge to parts of the graph, which wouldn\'t get infected otherwise, but itself is not infected.\nThe difference is marked in the code:\n```\nclass Solution {\npublic:\n    int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {\n   \t\tint n = graph.size();\n\t\t// just a bit of speed-up for later:\n        for (int i = 0; i < n; ++i){\n            vector<int> indices;\n            for (int j = 0; j < n; ++j){\n                if (graph[i][j] && i != j)\n                    indices.push_back(j);\n            }\n            graph[i] = indices;\n        }\n            \n        int minidx = -1, mincnt = INT_MAX;\n        // for (int i = n - 1; i >= 0; --i){ // this covers all cases\n        sort(initial.begin(), initial.end()); // to finish with the first infected...\n        for (int ii = initial.size() - 1; ii >= 0; --ii){ // going through infected vertices only...\n            int i = initial[ii];\n            queue<int> q;\n            for (int j : initial){\n                if (j != i) q.push(j);\n            }\n            vector<bool> visited(n);\n            int cnt = 0;\n            while(!q.empty()){\n                int j = q.front(); q.pop();\n                if (!visited[j]){\n                    visited[j] = true;\n                    ++cnt;\n                    for (int k : graph[j]){\n                        if (!visited[k] && k != i){\n                            q.push(k);\n                        }\n                    }\n                }\n            }\n            if (cnt <= mincnt){\n                mincnt = cnt;\n                minidx = i;\n            }\n        }\n        return minidx;\n    }\n};\n```
['Breadth-First Search', 'C', 'C++']