面试题 01.04
Solutions
class Solution {
public:
bool canPermutePalindrome(string s) {
vector<int> count(128);
int odd = 0;
for (auto c : s)
odd += (++count[c] & 1) ? 1 : -1;
return odd <= 1;
}
};Last updated