其他分享
首页 > 其他分享> > LeetCode --- 953. Verifying an Alien Dictionary 解题报告

LeetCode --- 953. Verifying an Alien Dictionary 解题报告

作者:互联网

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 lexicographicaly in this alien language.

 

Example 1:

Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
Output: true
Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.

Example 2:

Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
Output: false
Explanation: As 'd

标签:alien,letters,Dictionary,language,sequence,Verifying,Alien,words,order
来源: https://blog.csdn.net/u012965373/article/details/118068552