Easy to understand JavaScript solution (Greedy)
Complexity\n- Time complexity:\nO(mn)\n\n- Space complexity:\nO(mn)\n\n# Code\n\nvar minimumTeachings = function(n, languages, friendships) {\n    const size = 
# Complexity\n- Time complexity:\n$$O(mn)$$\n\n- Space complexity:\n$$O(mn)$$\n\n# Code\n```\nvar minimumTeachings = function(n, languages, friendships) {\n    const size = languages.length;\n    const communicate = Array(size).fill(\'\').map(_ => Array(n).fill(false));\n    const users = new Set();\n    let result = Number.MAX_SAFE_INTEGER;\n\n    for (let index = 0; index < size; index++) {\n        for (const language of languages[index]) {\n            communicate[index][language - 1] = true;\n        }\n    }\n    for (const [a, b] of friendships) {\n        const isCommunicate = communicate[a - 1].some((isKnow, language) => {\n            return isKnow ? communicate[b - 1][language] : isKnow;\n        });\n\n        if (isCommunicate) continue;\n        users.add(a - 1).add(b - 1);\n    }\n    for (let language = 0; language < n; language++) {\n        let teach = 0;\n\n        for (const user of users) {\n            !communicate[user][language] && teach++\n        }\n        result = Math.min(teach, result);\n    }\n    return result;\n};\n```
['JavaScript']