One language to rule them all
IntuitionApproachComplexity

Time complexity:
O(n^2)


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:
O(n^2)

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

# Code
```javascript []
/**
 * @param {number} n
 * @param {number[][]} languages
 * @param {number[][]} friendships
 * @return {number}
 */
var minimumTeachings = function (n, languages, friendships) {
  let langList = Array(n)
    .fill(0)
    .map(() => new Set());
  for (let i = 0; i < languages.length; i++) {
    let langs = languages[i];
    for (let l of langs) {
      langList[l - 1].add(i);
    }
  }
  let illat = new Set();
  for (let [one, two] of friendships) {
    let oneLangs = languages[one - 1];
    let twoLangs = languages[two - 1];
    let can = false;
    for (let l of oneLangs) {
      if (langList[l - 1].has(one - 1) && langList[l - 1].has(two - 1)) {
        can = true;
        break;
      }
    }

    if (can) {
      continue;
    }
    illat.add(one - 1);
    illat.add(two - 1);
  }
  let mostSpoken = 0;
  let pplWho = 0;
  for (let i = 0; i < n; i++) {
    let counter = 0;
    for (let j of illat) {
      if (langList[i].has(j)) {
        counter++;
      }
    }
    if (counter > pplWho) {
      mostSpoken = i;
      pplWho = counter;
    }
  }
  return illat.size - pplWho;
};
```
['JavaScript']