原题题目
代码实现(首刷自解)
class Solution {
public:void backtracking(unordered_map<int,int>& map,int& ret){
for(auto& pair:map){
if(!pair.second) continue;--pair.second;++ret;backtracking(map,ret);++pair.second;}}int numTilePossibilities(string tiles) {
unordered_map<int,int> map;for(const auto& chr:tiles) ++map[chr-'A'];int ret = 0;backtracking(map,ret);return ret;}
};