Python 3   ||   5 lines,  w/ explanation and example   ||   T/S: 95% / 45%
Here\'s the plan:\n- Determine the group of users who do not have a common language with at least one friend.\n- Determine the most common language in that grou
Here\'s the plan:\n- Determine the group of users who do not have a common language with at least one friend.\n- Determine the most common language in that group.\n- Return the number in the group who do not speak that language.\n```\nclass Solution:\n    def minimumTeachings(self, n, languages, friendships):\n                                                            # Example:\n        l = list(map(set,languages))                        #  friendships = [[1,4],[1,2],[3,4],[2,3]]\n                                                            #    languages = [[2]  ,[1,3],[1,2],[1,3]]\n        users = set(chain(*((i-1,j-1) for i,j in \n                       friendships if not l[i-1]&l[j-1])))  #  users = {0,1,3} <- zero-indexed\n\n        if not users: return 0\n\n        ctr = Counter(chain(*[languages[i] for i in users])) #  ctr = {1:2, 3:2, 2:1}\n        \n        return len(users) - max(ctr.values())                #  return len({0,1,3}) - max(2,2,1) = 3 - 2 = 1\n```\n[https://leetcode.com/problems/minimum-number-of-people-to-teach/submissions/1280009930/](https://leetcode.com/problems/minimum-number-of-people-to-teach/submissions/1280009930/)\n\n\n\nI could be wrong, but I think that time complexity is *O*(*M* + *N*) and space complexity is *O*(*M* + *N*).\n
['Python3']