953. Verifying An Alien Dictionary
Practice Verifying An Alien Dictionary for free on NudgeCode: Easy, Graph pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
An alien language uses the 26 lowercase English letters, but in a different order. order lists all 26 letters from first to last in that language. Return true if words is sorted in the alien dictionary order.
Words are compared letter by letter; the first differing letter decides. If one word is a prefix of the other, the shorter word comes first.
Example
words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz" -> true
Constraints
- 1 <= words.length <= 100
- 1 <= words[i].length <= 20
orderis a permutation of the 26 lowercase letters