266. Palindrome Permutation Posted on 2020-12-30 Edited on 2021-01-25 In LeetCode Disqus: Symbols count in article: 236 Reading time ≈ 1 mins. O(n) time O(1) space 1234567891011class Solution {public: bool canPermutePalindrome(string s) { int f[128] = {0}; int odd_cnt = 0; for (char c : s) { odd_cnt += ((++f[c] & 1) << 1) - 1; // 奇数++偶数-- } return odd_cnt <= 1; }};