LeetCode 266 Palindrome Permutation

LeetCode 266 Palindrome Permutation Problem

Download Code
class Solution(object):
    def canPermutePalindrome(self, s):
        :type s: str
        :rtype: bool
        dic = {}
        for c in s:
            dic[c] = dic.get(c, 0) + 1
        odd, even = 0, 0
        for c in dic:
            if dic[c] % 2 == 0:
                even += 1
                odd += 1
        if odd <= 1:
            return True
        return False
Download Palindrome Permutation.py

List of all Palindrome Permutation problems

Leetcode 266 Palindrome Permutation problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.

Feedback is the most important part of any website.

If you have any query, suggestion or feedback, Please feel free to contact us.