266.回文排列
class Solution {
public:
bool canPermutePalindrome(string s) {
bitset<256> b; //长度为256,初始为0
for (auto c : s) { //对每个字符,将b中相应位置(ASC码表示)反转
b.flip(c);
}
return b.count() < 2; //统计b中1的个数,必须小于2
}
};最后更新于