Alien dictionary: check sorted order, then infer the alphabet
- 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.
- 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.
No answer yet. Write the first one; the best answer gets endorsed.
