Skip to content

Commit 6bc435a

Browse files
committed
Update alien-dictionary.py
1 parent 1c346f7 commit 6bc435a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Python/alien-dictionary.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ def alienOrder(self, words):
88
:type words: List[str]
99
:rtype: str
1010
"""
11-
# Find ancestors of each node by BFS
1211
result, zero_in_degree_queue, in_degree, out_degree = [], collections.deque(), {}, {}
1312
nodes = sets.Set()
14-
for i in xrange(len(words)):
15-
for c in words[i]:
13+
for word in words:
14+
for c in word:
1615
nodes.add(c)
1716

1817
for i in xrange(1, len(words)):

0 commit comments

Comments
 (0)