python greedy solution
\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        counter = [set() for i in r
```\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        counter = [set() for i in range(len(languages))]\n        memo = dict()\n        for i in range(len(languages)):\n            for j in languages[i]:\n                counter[i].add(j)\n\n\n        for i in range(len(friendships)):\n            disc = False\n\n            for j in languages[friendships[i][1]-1]:\n                if j in counter[friendships[i][0]-1]:\n                    disc = True\n                    break\n\n            if disc == False:\n                memo[friendships[i][0]] = 0\n                memo[friendships[i][1]] = 0\n\n        cur = dict()\n        disc_friends = list(memo.keys())\n        max_language = 0\n        for i in disc_friends:\n            for j in languages[i-1]:\n                if j in cur:\n                    cur[j] += 1\n                else:\n                    cur[j] = 1\n                max_language = max(max_language,cur[j])\n\n        return len(disc_friends)-max_language\n\n\n```
[]