其他分享
首页 > 其他分享> > 784. 字母大小写全排列

784. 字母大小写全排列

作者:互联网

 1 class Solution 
 2 {
 3 public:
 4     vector<string> letterCasePermutation(string S) 
 5     {
 6         vector<string> res;
 7         backTracking(res,S,0);
 8         return res;
 9     }
10     
11     void backTracking(vector<string> &res,string S,int i)
12     {
13         if(i==S.size())
14         {
15             res.push_back(S);
16             return;
17         }
18         if(isdigit(S[i])) backTracking(res,S,i+1);
19         else
20         {
21             S[i]=tolower(S[i]);
22             backTracking(res,S,i+1);
23             S[i]=toupper(S[i]);
24             backTracking(res,S,i+1);
25         }
26     }
27 };

 

标签:784,return,string,int,res,字母,vector,大小写,backTracking
来源: https://www.cnblogs.com/yuhong1103/p/12732581.html