提示:以下是本篇文章正文内容,下面案例可供参考。
//力扣代码
class Solution {const char* numStrArr[10]={"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
public:void Combine(const string& digits,int i,string combineStr,vector<string>& ret){if(i == digits.size()){ret.push_back(combineStr);return;}int num=digits[i]-'0';string str=numStrArr[num];for(auto ch:str)Combine(digits,i+1,combineStr+ch,ret);}vector<string> letterCombinations(string digits) {vector<string> v;if(digits.empty())return v;string str;Combine(digits,0,str,v);return v;}
};
总结
例如:以上就是今天要讲的内容,本文仅仅简单介绍了c++的小知识。