LeetCode #17 电话号码的字母组合

class Solution {
public:
    vector letterCombinations(string digits) {
        map phone={{2,"abc"},
                                {3,"def"},
                                {4,"ghi"},
                                {5,"jkl"},
                                {6,"mno"},
                                {7,"pqrs"},
                                {8,"tuv"},
                                {9,"wxyz"}};
        vector ans;
        string s;
        int i,m,j,flag;
        vector nums(digits.size());
        if(digits.size()==0){
            return ans;
        }
        for(i=0;i n(digits.size(),0);
        m=phone[nums[0]].size();
        while(n[0]=0){
                n[j]+=flag;
                if(n[j]==phone[nums[j]].size()&&j!=0){
                    n[j]=0;
                    flag=1;
                }
                else{
                    flag=0;
                }
                j--;
            }
        }
        return ans;
    }
};

你可能感兴趣的:(LeetCode #17 电话号码的字母组合)