C# Solution using Set || Easy To understand
\n\npublic class Solution {\n    public int MinimumTeachings(int n, int[][] languages, int[][] friendships) {\n        HashSet<int> langsUnion = new HashSet<int
\n```\npublic class Solution {\n    public int MinimumTeachings(int n, int[][] languages, int[][] friendships) {\n        HashSet<int> langsUnion = new HashSet<int>();\n        HashSet<int> diffSet = new HashSet<int>();\n        foreach(var friend in friendships){\n            int u = friend[0] - 1, v = friend[1] - 1;\n            foreach(var l in languages[u]) langsUnion.Add(l);\n            foreach(var l in languages[v]) langsUnion.Add(l);\n            if(langsUnion.Count == languages[u].Length + languages[v].Length){ // different\n                diffSet.Add(u);\n                diffSet.Add(v);\n            }\n            langsUnion.Clear(); \n        }\n        Dictionary<int,int> freq = new Dictionary<int,int>();\n        int maxCommoonLang = 0;\n        foreach(var friend in diffSet){\n            foreach(var l in languages[friend]){\n                freq.TryAdd(l,0);\n                freq[l]++;\n                maxCommoonLang = Math.Max(freq[l],maxCommoonLang);\n            }\n        }\n        return diffSet.Count - maxCommoonLang;\n    }\n}\n```
['C#']