解题思路:
(1)数学思想,抽屉原理
class Solution {
public:
bool canConstruct(string s, int k) {
if(s.length()<k) return false;
unordered_map<char,int> mp;
for(int i=0;i<s.length();i++) {
mp[s[i]]++;
}
int count=0;
for(auto it=mp.begin();it!=mp.end();it++) {
if(it->second%2==1) count++;
}
if(count>k) return false;
return true;
}
};