Palindrome Permutation
Description
null
Solution(javascript)
/**
* @param {string} s
* @return {boolean}
*/
const canPermutePalindrome = function (s) {
const map = {}
let oddCount = 0
for (const c of s) {
map[c] = map[c] || 0
map[c] += 1
if (map[c] % 2 === 0) {
oddCount -= 1
} else {
oddCount += 1
}
}
return oddCount <= 1
}