verifying an alien dictionary
1from typing import List
2
3class Solution:
4 def isAlienSorted(self, words: List[str], order: str) -> bool:
5 orderd = {L: O for O, L in enumerate(order)}
6 for w1, w2 in zip(words[0:], words[1:]):
7 for l1, l2 in zip(w1, w2):
8 if orderd[l1] == orderd[l2]:
9 continue
10 elif orderd[l1] > orderd[l2]:
11 return False
12 else:
13 break
14 else:
15 if len(w1) > len(w2):
16 return False
17 return True