Easy DFS C++ Solution with explanation :)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:     \n    void prepare(unordered_map<int, set<int>> &adj, vector<vector<int>>& graph)\n    {\n        int n = graph.size();\n        for(int i = 0 ; i < n ; i++)\n        {\n            for(int j = 0 ; j < n ; j++)\n            {\n                if(i != j && graph[i][j] == 1)\n                {\n                    adj[i].insert(j);\n                    adj[j].insert(i);\n                }\n            }\n        }\n    }\n    void dfs(int node, unordered_map<int, set<int>> &adj, vector<int> &vis, int *cnt)\n    {\n        vis[node] = 1;\n        *cnt = *cnt + 1;\n        for(auto it: adj[node])\n        {\n            if(!vis[it])\n            {\n                dfs(it, adj, vis, cnt);\n            }\n        }\n    }\n    int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {\n        int n = graph.size();\n        unordered_map<int, set<int>> adj;\n        prepare(adj, graph);\n\n// Logic: Try to remove each initial malicious node from graph and then call dfs for each other malicious node and count how many infected.(i,e. given by the total nodes reachable from thode rest initial nodes)\n// The one node on whose removal we have the least number of infected nodes is the answer.\n// To remove a node, just at initialization make its visited 1. So all it will never be called by dfs. (Good Trick)\n        int ans = initial[0];\n        int infected = INT_MAX;\n        for(int i = 0 ; i < initial.size() ; i++)\n        {\n            vector<int> vis(n, 0);\n            vis[initial[i]] = 1;\n            int count_infected = 0;\n            for(int j = 0 ; j < initial.size() ; j++)\n            {\n                if(!vis[initial[j]])\n                {\n                    dfs(initial[j], adj, vis, &count_infected);\n                }\n            }\n            if(count_infected < infected)\n            {\n                infected = count_infected;\n                ans = initial[i];\n            }\n            else if(count_infected == infected)\n            {\n                ans = min(ans, initial[i]);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']