Skip to content

Commit ceb4422

Browse files
committed
Update palindrome-pairs.py
1 parent f39e8f1 commit ceb4422

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Python/palindrome-pairs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def palindromePairs(self, words):
3939
res.append([lookup[prefix[::-1]], i])
4040
return res
4141

42+
43+
# Time: O(n * k^2), n is the number of the words, k is the max length of the words.
44+
# k is the max length of the words.
45+
# Space: O(n * k)
4246
# Trie solution.
4347
class TrieNode:
4448
def __init__(self):
@@ -73,10 +77,6 @@ def is_palindrome(self, s, j):
7377
j -= 1
7478
return True
7579

76-
# Time: O(n * k^2), n is the number of the words, k is the max length of the words.
77-
# k is the max length of the words.
78-
# Space: O(n * k)
79-
# Trie solution.
8080
class Solution_MLE(object):
8181
def palindromePairs(self, words):
8282
"""

0 commit comments

Comments
 (0)