孟祥忠诗歌

关注

Leetcode 面试题 01.04. 回文排列

孟祥忠诗歌

关注

阅读 137

2022-09-03


Leetcode ​​面试题 01.04. 回文排列​​

class Solution {
public:
bool canPermutePalindrome(string s) {
std::map<char,int> m;
for(char& ch : s)
{
m[ch]++;
}
std::map<char,int>::iterator it = m.begin();
int cnt = 0;
while(it != m.end())
{
if(it->second%2!=0)
cnt++;
it++;
}
return cnt < 2;
}
};

Leetcode 面试题 01.04. 回文排列_leetcode


相关推荐

天天天蓝loveyou

【leetcode】面试题 01.04. 回文排列

天天天蓝loveyou 93 0 0

闲嫌咸贤

面试题 01.04. 回文排列(简单)

闲嫌咸贤 88 0 0

我是小瘦子哟

LeetCode题解(面试01.04):判断字符串是否为可转换为回文排列(Python)

我是小瘦子哟 142 0 0

Python芸芸

LeetCode 面试题 02.06. 回文链表

Python芸芸 46 0 0

you的日常

#yyds干货盘点# LeetCode面试题:全排列

you的日常 111 0 0

一世独秀

#yyds干货盘点# LeetCode面试题:排列序列

一世独秀 60 0 0

就是耍帅

#yyds干货盘点# LeetCode面试题:回文数

就是耍帅 89 0 0

暮晨夜雪

#yyds干货盘点# LeetCode面试题:全排列 II

暮晨夜雪 105 0 0

尤克乔乔

#yyds干货盘点# LeetCode面试题:最长回文子串

尤克乔乔 109 0 0

TiaNa_na

#yyds干货盘点# LeetCode面试题:下一个排列

TiaNa_na 51 0 0

精彩评论(0)

0 0 举报