← Questions

Alien dictionary: check sorted order, then infer the alphabet

0
MetaCodingLast asked Jun 2026
  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.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding