17. Letter Combinations of a Phone Number
来源:互联网 发布:儿童认字软件 编辑:程序博客网 时间:2024/05/22 06:13
vector<string> letterCombinations(string digits) { int n = digits.size(); if (n == 0) return vector<string>(); vector<vector<string>> res(n); vector<vector<string>> temp = { {" "}, { "#" }, { "a","b","c" }, { "d","e","f" }, { "g","h","i" }, { "j","k","l" }, { "m","n","o" }, { "p","q","r","s" }, { "t","u","v" }, { "w","x","y","z" } }; for (int i = 0; i < n; i++) { for (auto letter : temp[digits[i] - '0']) { if (i == 0) { res[i].push_back(letter); continue; } for (auto anwser : res[i-1]) { res[i].push_back(anwser + letter); } } } return res[n - 1];}
0 0
- 17.Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 17. Letter Combinations of a Phone Number
- 使用库函数API和C代码中嵌入汇编代码两种方式使用同一个系统调用
- Eclipse安装tomcat插件
- 快速排序算法
- Ajax状态码
- struts2上传文件(二) jsp上传文件
- 17. Letter Combinations of a Phone Number
- vim插件之王——YouCompleteMe
- 欢迎使用CSDN-markdown编辑器
- LeetCode-73-Set Matrix Zeroes(数组)-Medium
- 压缩感知的MP算法
- hdoj--2068--RPG的错排(错排公式)
- 数据库存储过程与触发器
- struts2上传文件(三) struts2上传文件
- NDK开发笔记(一)