[Python3] Simple | With Comments
\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        ans = inf\n        language
```\nclass Solution:\n    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n        ans = inf\n        languages = [set(x) for x in languages]\n        \n        for language in range(1, n+1):\n            curr, seen = 0, set()\n            \n            for a,b in friendships:\n                if len(languages[a-1] & languages[b-1]) == 0: # if no common languaes i.e, friends cannot communicate\n                    \n                    if language not in languages[a-1] and a not in seen:\n                        curr += 1\n                        seen.add(a)\n                    if language not in languages[b-1] and b not in seen:\n                        curr += 1\n                        seen.add(b)\n                        \n                if curr >= ans: break # Early break condition \n                    \n            ans = min(ans, curr)\n        return ans\n```
[]