ap n^2
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:\nint k(int node,vector<int> adj[],vector<int>&ini,int n1)\n{\n    vector<int> vis(n1,0);\n    queue<int> q;\n    for(auto i:ini)\n    {\n        if(i==node)continue;\n        q.push(i);\n        vis[i]=1;\n    }\n    vector<int> ans;\n    while(!q.empty())\n    {\n        int n=q.front();\n        q.pop();\n        ans.push_back(n);\n        for(auto i:adj[n])\n        {\n            if(i==node)continue;\n            if(!vis[i])\n            {\n                vis[i]=1;\n                q.push(i);\n            }\n        }\n    }\n    return ans.size();\n}\n    int minMalwareSpread(vector<vector<int>>& graph, vector<int>& ini) {\n        int n=graph.size();\n        vector<int> adj[n];\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<n;j++)\n            {\n                if(graph[i][j])\n                {\n                    adj[i].push_back(j);\n                }\n            }\n        }\n        sort(ini.begin(),ini.end());\n        int mini=k(ini[0],adj,ini,n);\n        int ans=ini[0];\n        for(int i=1;i<ini.size();i++)\n        {\n            if(k(ini[i],adj,ini,n)<mini)\n            {\n                mini=k(ini[i],adj,ini,n);\n                ans=ini[i];\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']