Skip to content

Commit ccb6c7d

Browse files
committed
Update palindrome-permutation-ii.py
1 parent 9062dbe commit ccb6c7d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/palindrome-permutation-ii.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ def generatePalindromes(self, s):
88
:rtype: List[str]
99
"""
1010
cnt = collections.Counter(s)
11-
mid = [k for k, v in cnt.iteritems() if v % 2]
11+
mid = ''.join(k for k, v in cnt.iteritems() if v % 2)
1212
chars = ''.join(k * (v / 2) for k, v in cnt.iteritems())
13-
return [''.join(half_palindrome + mid + half_palindrome[::-1]) \
14-
for half_palindrome in self.permuteUnique(chars)] if len(mid) < 2 else []
13+
return [half_palindrome + mid + half_palindrome[::-1] \
14+
for half_palindrome in self.permuteUnique(chars)] if len(mid) < 2 else []
1515

1616
def permuteUnique(self, nums):
1717
result = []

0 commit comments

Comments
 (0)