1733. Minimum Number of People to Teach
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:
        lang_sets = [set(lang) for lang in languages]
        needs_teaching = set()

        for u, v in friendships:
            if not lang_sets[u - 1] & lang_sets[v - 1]:
                needs_teaching.add(u - 1)
                needs_teaching.add(v - 1)

        if not needs_teaching:
            return 0

        lang_count = [0] * (n + 1)
        for user in needs_teaching:
            for lang in lang_sets[user]:
                lang_count[lang] += 1

        return len(needs_teaching) - max(lang_count)

```
['Python3']