Alien dictionary: check sorted order, then infer the alphabet

0
Remix
  1. You are given the order of letters in an unfamiliar alphabet and a list of words. Return whether the words are sorted according to that alphabet.
  2. Now the alphabet is unknown: given a list of words already sorted in it, return one possible order of the letters, or report that none exists (the words contradict each other, or a word comes before its own prefix). State the time and space precisely.
MetaTechnical phone screenLast asked Jun 2026
No answer yet. Write the first one; the best answer gets endorsed.