Skip to content

Commit 1fcbf51

Browse files
committed
Create README - LeetHub
1 parent 85289d1 commit 1fcbf51

File tree

1 file changed

+38
-0
lines changed
  • String/0953-verifying-an-alien-dictionary

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h2><a href="https://leetcode.com/problems/verifying-an-alien-dictionary/">953. Verifying an Alien Dictionary</a></h2><h3>Easy</h3><hr>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.
2+
3+
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.
4+
5+
 
6+
7+
Example 1:
8+
9+
10+
Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz"
11+
Output: true
12+
Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.
13+
14+
15+
Example 2:
16+
17+
18+
Input: words = ["word","world","row"], order = "worldabcefghijkmnpqstuvxyz"
19+
Output: false
20+
Explanation: As 'd' comes after 'l' in this language, then words[0] > words[1], hence the sequence is unsorted.
21+
22+
23+
Example 3:
24+
25+
26+
Input: words = ["apple","app"], order = "abcdefghijklmnopqrstuvwxyz"
27+
Output: false
28+
Explanation: The first three characters "app" match, and the second string is shorter (in size.) According to lexicographical rules "apple" > "app", because 'l' > '∅', where '∅' is defined as the blank character which is less than any other character (More infohttps://en.wikipedia.org/wiki/Lexicographical_order).
29+
30+
31+
 
32+
33+
Constraints:
34+
35+
* 1 <= words.length <= 100
36+
* 1 <= words[i].length <= 20
37+
* order.length == 26
38+
* All characters in words[i] and order are English lowercase letters.

0 commit comments

Comments
 (0)