Hashing || C++
Code\n\nclass Solution \n{\npublic:\n    int minimumTeachings(int lang, vector<vector<int>>& languages, vector<vector<int>>& friendships) \n    {\n        map<i
# Code\n```\nclass Solution \n{\npublic:\n    int minimumTeachings(int lang, vector<vector<int>>& languages, vector<vector<int>>& friendships) \n    {\n        map<int,set<int>> m;\n        int n=languages.size();\n        for(int x=0; x<n; x++)\n        {\n            set<int> st;\n            for(auto it: languages[x]) st.insert(it);\n            m[x+1]=st;\n        }\n        map<int,int> mp;\n        set<int> unresolved;\n        for(auto it: friendships)\n        {\n            auto st1=m[it[0]];\n            auto st2=m[it[1]];\n            int found=0;\n            for(auto i: st1)\n            {\n                if(st2.find(i)!=st2.end())\n                {\n                    found=1;\n                    break;\n                }\n            }\n            if(!found)\n            {\n                unresolved.insert(it[0]);\n                unresolved.insert(it[1]);\n            }\n        }\n        for(auto it: unresolved)\n        {\n            for(auto i: m[it]) mp[i]++;\n        }\n        int mx=0, num=0;\n        for(auto it: mp) \n        {\n            if(mx<it.second)\n            {\n                mx=it.second;\n                num=it.first;\n            }\n        }\n        int ans=0;\n        for(auto it: unresolved)\n        {\n            auto st=m[it];\n            if(st.find(num)==st.end()) ans++;\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'C++']