Skip to content

Commit 3cf8599

Browse files
committed
Create palindrome-permutation.py
1 parent 3c7925f commit 3cf8599

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Python/palindrome-permutation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Time: O(n)
2+
# Space: O(n)
3+
4+
class Solution(object):
5+
def canPermutePalindrome(self, s):
6+
"""
7+
:type s: str
8+
:rtype: bool
9+
"""
10+
return sum(v % 2 for k, v in collections.Counter(s).iteritems()) < 2

0 commit comments

Comments
 (0)