Verifying an Alien Dictionary

Try to solve the Verifying an Alien Dictionary problem.

Statement

You’re given a list of words with lowercase English letters in a different order, written in an alien language. The order of the alphabet is some permutation of lowercase letters of the English language.

We have to return TRUE if the given list of words is sorted lexicographically in this alien language.

Constraints:

  • 1≤1 \leq words.length ≤103\leq 10^3
  • 1≤1 \leq words[i].length ≤20\leq 20
  • order.length ==26== 26
  • All the characters in words[i] and order are lowercase English letters.

Examples

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy