Practice Verifying an Alien Dictionary
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien language.
Source: Verifying an Alien Dictionary on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
true
# Example 2
words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
false
# Example 3
words = ["apple","app"], order = "abcdefghijklmnopqrstuvwxyz"
false
Constraints
Related LeetCode Problems
Practice more problems similar to Verifying an Alien Dictionary.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.