c++ easy solution using hashmap
\nclass Solution {\npublic:\n    bool intersection(vector<int>a,vector<int>b){\n       for(int i=0;i<a.size();i++){\n           for(int j=0;j<b.size();j++){\n  
```\nclass Solution {\npublic:\n    bool intersection(vector<int>a,vector<int>b){\n       for(int i=0;i<a.size();i++){\n           for(int j=0;j<b.size();j++){\n              \n               if(a[i]==b[j])return true;\n           }\n       \n       }\n        return false;\n    }\n    \n    int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n        unordered_map<int,vector<int>>ump;\n        int l=languages.size();\n        int f=friendships.size();\n        set<int>s;\n        for(int i=0;i<f;i++){\n            \n            if(!intersection(languages[friendships[i][0]-1],languages[friendships[i][1]-1])){\n                \n                s.insert(friendships[i][0]);\n                s.insert(friendships[i][1]);\n            }\n        }\n        \n       \n        for(int j=0;j<l;j++){\n            if(s.find(j+1)==s.end()) continue;\n            for(int k=0;k<languages[j].size();k++){\n                 ump[languages[j][k]].push_back(j+1);\n            }\n        }\n        \n        int ans=0;\n        for(int i=1;i<=ump.size();i++){\n           if(ans<ump[i].size())ans=ump[i].size();\n        }\n          \n        return s.size()-ans;\n        \n        \n    }\n};\n```
['C', 'Ordered Set', 'C++']