# 266 Palindrome Permutation

`Input: s = "code"Output: FalseExplanation: No solution`
`Input: s = "aab"Output: TrueExplanation: "aab" --> "aba"`
`Input: s = "carerac"Output: TrueExplanation: "carerac" --> "carerac"`
`class Solution:    def canPermutePalindrome(self, s):        cnt,total_odds=0,0        hash=dict()        for i in s:            if i in hash:                hash[i]+=1            else:                hash[i]=1            cnt+=1           print(cnt)                 for i in hash:            total_odds+=hash[i]%2        return(total_odds<=1)`
`class Solution:    def canPermutePalindrome(self, s):        set_=set()        for i in s:            if i in set_:                set_.remove(i)             else:                set_.add(i)        return(len(set_)<=1)`
`class Solution:    def canPermutePalindrome(self, s):        mask=0        for c in s:             if (mask & 1<<ord(c) == 0):                mask|=1<<ord(c)            else:                mask&=~(1<<ord(c))        return(mask&(mask-1)==0)`

--

--

Tech-Enthusiast, Coder,Explorer,Geeky,Software Engineer |A piece of code delivers everything that you need. The world is all about codes.

Love podcasts or audiobooks? Learn on the go with our new app.

## Dhanarajappu

Tech-Enthusiast, Coder,Explorer,Geeky,Software Engineer |A piece of code delivers everything that you need. The world is all about codes.