Skip to content

Commit e52bc11

Browse files
committed
comment modify
1 parent d7123a4 commit e52bc11

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

group-anagrams/hoyeongkwak.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
class Solution:
1313
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
1414
strResult = {}
15-
for str in strs:
16-
sortedStr = ''.join(sorted(str))
15+
for word in strs:
16+
sortedStr = ''.join(sorted(word))
1717
if sortedStr not in strResult:
1818
strResult[sortedStr] = []
19-
strResult[sortedStr].append(str)
19+
strResult[sortedStr].append(word)
2020
return list(strResult.values())

implement-trie-prefix-tree/hoyeongkwak.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
space complexity : O(1)
1313
'''
1414

15-
class TriedNode:
15+
class TrieNode:
1616
def __init__(self):
1717
self.children = {}
1818
self.isEnd = False
1919

2020
class Trie:
2121
def __init__(self):
22-
self.root = TriedNode()
22+
self.root = TrieNode()
2323

2424
def insert(self, word: str) -> None:
2525
node = self.root
2626
for char in word:
2727
if char not in node.children:
28-
node.children[char] = TriedNode()
28+
node.children[char] = TrieNode()
2929
node = node.children[char]
3030
node.isEnd = True
3131

word-break/hoyeongkwak.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''
2-
TriedNode
2+
TrieNode
33
a : alphabet size
44
time complexity : O(m)
55
space complexity : O(m * a)
@@ -8,19 +8,19 @@
88
time complexity : O(n^2)
99
space complexity : O(n)
1010
'''
11-
class TriedNode:
11+
class TrieNode:
1212
def __init__(self):
1313
self.children = {}
1414
self.isEnd = False
1515
class Trie:
1616
def __init__(self):
17-
self.root = TriedNode()
17+
self.root = TrieNode()
1818

1919
def insert(self, word):
2020
node = self.root
2121
for char in word:
2222
if char not in node.children:
23-
node.children[char] = TriedNode()
23+
node.children[char] = TrieNode()
2424
node = node.children[char]
2525
node.isEnd = True
2626

0 commit comments

Comments
 (0)