Leetcode - Palindrome Permutation
https://leetcode.com/problems/palindrome-permutation/
Given a string, determine if a permutation of the string could form a palindrome.
Example 1:
Input: "code"
Output: false
Example 2:
Input: "aab"
Output: true
Example 3:
Input: "carerac"
Output: true
func canPermutePalindrome(s string) bool { hash := map[byte]int{} for i := 0; i < len(s); i++ { hash[s[i]]++ } oddCount := 0 for _, val := range hash { if val % 2 == 1 { oddCount++ } } if oddCount > 1{ return false } return true }