javascript 176ms
\nconst minimumTeachings = (n, languages, friendships) => {\n    let ln = languages.length;\n    let canCommunicate = initialize2DArrayNew(ln, n);\n    for (let
```\nconst minimumTeachings = (n, languages, friendships) => {\n    let ln = languages.length;\n    let canCommunicate = initialize2DArrayNew(ln, n);\n    for (let l = 0; l < ln; l++) {\n        for (const x of languages[l]) {\n            canCommunicate[l][x - 1] = true;\n        }\n    }\n    let set = new Set();\n    for (const fr of friendships) {\n        let a = fr[0] - 1;\n        let b = fr[1] - 1;\n        let flag = false;\n        for (const x of languages[a]) {\n            if (canCommunicate[b][x - 1]) flag = true;\n        }\n        if (flag) continue;\n        set.add(a);\n        set.add(b);\n    }\n    let res = Number.MAX_SAFE_INTEGER;\n    for (let i = 0; i < n; i++) {\n        let teach = 0;\n        for (const user of set) {\n            if (!canCommunicate[user][i]) teach++;\n        }\n        res = Math.min(res, teach);\n    }\n    return res;\n};\n\nconst initialize2DArrayNew = (m, n) => {\n    let data = [];\n    for (let i = 0; i < m; i++) {\n        let tmp = new Array(n).fill(false);\n        data.push(tmp);\n    }\n    return data;\n};\n```
['JavaScript']