当前位置: 首页 > news >正文

网站过期就可以抢注PHP框架和wordpress

网站过期就可以抢注,PHP框架和wordpress,百度推广登录首页官网,网页怎么做给定一个仅包含数字 2-9 的字符串#xff0c;返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下#xff08;与电话按键相同#xff09;。注意 1 不对应任何字母。 示例 1#xff1a; 输入#xff1a;digits 23 输出…给定一个仅包含数字 2-9 的字符串返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下与电话按键相同。注意 1 不对应任何字母。 示例 1 输入digits 23 输出[ad,ae,af,bd,be,bf,cd,ce,cf] 示例 2 输入digits 输出[] 示例 3 输入digits 2 输出[a,b,c] 提示 0 digits.length 4digits[i] 是范围 [2, 9] 的一个数字。 AC: /** lc appleetcode.cn id17 langcpp** [17] 电话号码的字母组合*/// lc codestart class Solution { private:const string letterMap[10] {,,abc,def,ghi,jkl,mno,pqrs,tuv,wxyz,}; public:string s;vectorstring result;void backtracking(const string digits, int index) {if(digits.size() index) {result.push_back(s);return ;}int digit digits[index] - 0;string letter letterMap[digit];for(int i 0; i letter.size(); i){s.push_back(letter[i]);backtracking(digits, index 1);s.pop_back();}}vectorstring letterCombinations(string digits) {s.clear();result.clear();if(digits.size() 0)return result;backtracking(digits, 0);return result;} }; // lc codeendThe function uses a private member variable letterMap to map each digit to its corresponding set of letters. The letterMap is an array of strings, where each string represents the set of letters corresponding to a digit. For example, letterMap[2] is the string “abc”, which represents the letters ‘a’, ‘b’, and ‘c’ corresponding to the digit 2. The function uses a recursive backtracking approach to generate all possible letter combinations. The backtracking function takes two arguments: the input string of digits and an index representing the current position in the input string. The function first checks if the current position is equal to the length of the input string. If so, it adds the current combination of letters to the result vector and returns. If the current position is less than the length of the input string, the function retrieves the set of letters corresponding to the current digit using the letterMap array. It then iterates over each letter in the set and adds it to the current combination of letters. The function then recursively calls itself with the updated combination of letters and the next index. After the recursive call returns, the function removes the last letter from the combination of letters to backtrack and try the next letter in the set. The letterCombinations function initializes the result vector and calls the backtracking function with the input string and an initial index of 0. If the input string is empty, the function returns an empty vector. Overall, this implementation is a simple and efficient way to generate all possible letter combinations of a given string of digits using a backtracking algorithm. One possible way to improve the code would be to add error checking to ensure that the input string only contains digits. Additionally, the variable names could be more descriptive to make the code easier to read and understand. How does the backtracking algorithm work in generating all possible letter combinations? The backtracking algorithm used in this code works by recursively generating all possible letter combinations of a given string of digits. The algorithm uses a private member variable letterMap to map each digit to its corresponding set of letters. The backtracking function takes two arguments: the input string of digits and an index representing the current position in the input string. The function first checks if the current position is equal to the length of the input string. If so, it adds the current combination of letters to the result vector and returns. If the current position is less than the length of the input string, the function retrieves the set of letters corresponding to the current digit using the letterMap array. It then iterates over each letter in the set and adds it to the current combination of letters. The function then recursively calls itself with the updated combination of letters and the next index. After the recursive call returns, the function removes the last letter from the combination of letters to backtrack and try the next letter in the set. The letterCombinations function initializes the result vector and calls the backtracking function with the input string and an initial index of 0 . If the input string is empty, the function returns an empty vector. Overall, the backtracking algorithm works by generating all possible letter combinations of a given string of digits by recursively iterating over each digit and its corresponding set of letters. The algorithm uses a simple and efficient approach to generate all possible combinations of letters, and is a common technique used in many other combinatorial problems .
http://www.w-s-a.com/news/187817/

相关文章:

  • 天津做网站得公司克隆网站到wordpress修改
  • 郫县网站建设网站建设报价单及项目收费明细表
  • 商标做网站logo建网站作业
  • 网站顶部展出的大幅广告中建八局第二建设有限公司
  • 公众微信绑定网站帐号优秀中文网页设计
  • 如何做漫画赚钱的网站企业网站管理系统c
  • 安康公司网站制作搜狗网站
  • 太仓住房与城乡建设局网站注册推广赚钱一个80元
  • wordpress 网站生成app企业网站改版的好处
  • 广州建站服务怎么让客户做网站
  • 南京手机网站设计公司wordpress导航页
  • 娄底市建设网站app网站开发小程序
  • 刷粉网站推广免费网站建设找王科杰信誉
  • 投标建设用地是哪个网站微信小程序多少钱
  • 做玄幻封面素材网站我国数字经济报告
  • 手机网站返回跳转wordpress带颜色的文字
  • 微信群领券网站怎么做创意广告图片
  • 跟我一起做网站嘉兴做网站哪家好
  • 上海知名建站公司山东住房和建设庭网站
  • 深圳市城乡建设部网站首页平台设计方案怎么做
  • 深圳美食教学网站制作wordpress列表图显示标题
  • 怎么做网址导航网站沈阳高端做网站建设
  • 棋牌网站开发需要多少钱整网站代码 带数据 免费 下载
  • 网站建设 sql 模版猎头用什么网站做单
  • 河北保定建设工程信息网站wordpress 远程缓存
  • 手机网站开发之列表开发win7网站开发教程
  • 楚雄市住房和城乡建设局网站廊坊企业网站建设
  • 东莞规划局官方网站wordpress添加文章页不显示图片
  • 做企业网站要哪些人员百度商城网站建设
  • c语言软件开和网站开发区别多产品的网站怎么做seo