[C++] || Set,Map
\nclass Solution {\npublic:\n    set<int> cantTalk ;\n    bool InCommon(vector<int>& lang1  , vector<int>&lang2 ){\n        //checks if two friends can speak an
```\nclass Solution {\npublic:\n    set<int> cantTalk ;\n    bool InCommon(vector<int>& lang1  , vector<int>&lang2 ){\n        //checks if two friends can speak any language in common ?\n        for(auto &x : lang1)\n            for(auto &y : lang2)\n                if(x == y) return true ;\n            \n        \n        return false ;        \n    }\n    \n    int minimumTeachings(int n, vector<vector<int>>& lang , vector<vector<int>>& friends) {\n        \n        for(auto &x : friends){\n            int u = x[0] , v = x[1] ;\n            //if two friends cannot speak any language in common then store them in cantTalk\n            if(!InCommon(lang[u-1],lang[v-1])){\n                cantTalk.insert(u) ;\n                cantTalk.insert(v) ;\n            }\n        }\n        \n        //maps the language --> user (only the ones which are present in set cantTalk)! \n        map<int,vector<int>> common ;\n        \n        for(int i = 0 ; i < lang.size() ; ++i ){\n            if(cantTalk.find(i+1) == end(cantTalk)) continue ;\n            for(auto &x : lang[i]) common[x].push_back(i+1) ;\n        }\n        \n        int maxCommonSpeaking = 0 ;\n        \n        //find the max number of users who can speak any language commonly \n        for(int i= 1 ; i <= n ; ++i ) maxCommonSpeaking = max(maxCommonSpeaking,(int)common[i].size()) ;\n        \n        //rest of the users left will need to be taught the language\n        return (int)cantTalk.size() - maxCommonSpeaking ;\n        \n        \n    }\n};\n```
['C']