O(friendships * languages) time, O(number_of_people space)
Approach\nFirst check who are the people that have some unsatisfying friendship (have a friend that they can\'t speak with).\nnow among those people check what 
# Approach\nFirst check who are the $$people$$ that have some unsatisfying friendship (have a friend that they can\'t speak with).\nnow among those $$people$$ check what is the most popular language.\nthis is the language that needs to be taught to all the $$people$$ that dont know it.\n\n\n# Code\n```\nclass Solution(object):\n    def minimumTeachings(self, n, languages, friendships):\n        """\n        :type n: int\n        :type languages: List[List[int]]\n        :type friendships: List[List[int]]\n        :rtype: int\n        """\n        people_need_lessons = set()        \n        for friends in friendships:\n            f1, f2 = friends[0], friends[1]\n            if len(set(languages[f1 - 1]).intersection(set(languages[f2 - 1]))) == 0:\n                people_need_lessons.add(f1)\n                people_need_lessons.add(f2)\n\n        most_freq_spoken_languages = [0] * n\n        for p in people_need_lessons:\n            for l in languages[p - 1]:\n                most_freq_spoken_languages[l - 1] += 1\n        return len(people_need_lessons) - max(most_freq_spoken_languages)\n\n\n        \n\n```
['Python']