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

重庆网站制作的网站seo词条

重庆网站制作的网站,seo词条,旅游网站后台模板下载,做网站的宽度为多少1 问题 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 示例 1: 输入:digits “23” 输出&…

1 问题

给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。答案可以按 任意顺序 返回。

给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。
在这里插入图片描述
示例 1:

输入:digits = “23”
输出:[“ad”,“ae”,“af”,“bd”,“be”,“bf”,“cd”,“ce”,“cf”]

示例 2:

输入:digits = “”
输出:[]

示例 3:

输入:digits = “2”
输出:[“a”,“b”,“c”]

2 答案

自己写的不对

class Solution:def letterCombinations(self, digits: str) -> List[str]:hashmap = {2:'abc', 3:'def', 4:'ghi', 5:'jkl', 6:'mno', 7:'pqrs', 8:'tuv', 9:'wxyz'}if digits = "" return []list1 = []res = []for s in digits:list1.append(hashmap[int(s)])for i in range(len(list1)):for j in range(i+1, len(list1)):ii = len(list1[i])jj = len(list1[j])while ii != -1: res.append(list1[i][ii]+list1[j][jj])ii -= 1

官方解1:回溯

class Solution:def letterCombinations(self, digits: str) -> List[str]:if not digits: return []phone = {'2':['a','b','c'],'3':['d','e','f'],'4':['g','h','i'],'5':['j','k','l'],'6':['m','n','o'],'7':['p','q','r','s'],'8':['t','u','v'],'9':['w','x','y','z']}def backtrack(conbination,nextdigit):if len(nextdigit) == 0:res.append(conbination)else:for letter in phone[nextdigit[0]]:backtrack(conbination + letter,nextdigit[1:])res = []backtrack('',digits)return res

官方解2:队列

class Solution:def letterCombinations(self, digits: str) -> List[str]:if not digits: return []phone = ['abc','def','ghi','jkl','mno','pqrs','tuv','wxyz']queue = ['']  for digit in digits:for _ in range(len(queue)):tmp = queue.pop(0)for letter in phone[ord(digit)-50]:queue.append(tmp + letter)return queue

感觉这两种方法都不太好理解,后面还要巩固一下

3 知识点

回溯:
当题目中出现 “所有组合” 等类似字眼时,我们第一感觉就要想到用回溯。


文章转载自:
http://dinncohydroxid.tpps.cn
http://dinncoeisa.tpps.cn
http://dinncotincture.tpps.cn
http://dinncobackroad.tpps.cn
http://dinncotubicolous.tpps.cn
http://dinncodiplomaism.tpps.cn
http://dinncoscrewworm.tpps.cn
http://dinncocinchonise.tpps.cn
http://dinncolabuan.tpps.cn
http://dinncomalpighiaceous.tpps.cn
http://dinncothiofuran.tpps.cn
http://dinncoinkstone.tpps.cn
http://dinncoarachne.tpps.cn
http://dinncopellicle.tpps.cn
http://dinncomildewy.tpps.cn
http://dinncotrivalency.tpps.cn
http://dinncoborn.tpps.cn
http://dinncomicrocomputer.tpps.cn
http://dinncochampertor.tpps.cn
http://dinncoandrophagous.tpps.cn
http://dinncostrobil.tpps.cn
http://dinncoallusion.tpps.cn
http://dinncomilitarize.tpps.cn
http://dinncodemoniac.tpps.cn
http://dinncofootlights.tpps.cn
http://dinncoosteosclerosis.tpps.cn
http://dinncodairy.tpps.cn
http://dinncocashbook.tpps.cn
http://dinncobacterial.tpps.cn
http://dinncohear.tpps.cn
http://dinncorepot.tpps.cn
http://dinncoconsumingly.tpps.cn
http://dinncoglassless.tpps.cn
http://dinncomaltworm.tpps.cn
http://dinncowisteria.tpps.cn
http://dinncoextraordinarily.tpps.cn
http://dinncomillie.tpps.cn
http://dinncorah.tpps.cn
http://dinncobintree.tpps.cn
http://dinncospendthrifty.tpps.cn
http://dinncocobelligerent.tpps.cn
http://dinncofourpenny.tpps.cn
http://dinncodiatonicism.tpps.cn
http://dinncoischium.tpps.cn
http://dinncorototill.tpps.cn
http://dinncoenterostomy.tpps.cn
http://dinncomegawatt.tpps.cn
http://dinncoaccoucheur.tpps.cn
http://dinncobock.tpps.cn
http://dinncodiesinker.tpps.cn
http://dinncoeruca.tpps.cn
http://dinncoexcelled.tpps.cn
http://dinncootp.tpps.cn
http://dinncointerjacent.tpps.cn
http://dinncothunderstroke.tpps.cn
http://dinncocrossroad.tpps.cn
http://dinncoarrastra.tpps.cn
http://dinncofileopen.tpps.cn
http://dinncoaperiodically.tpps.cn
http://dinncosinophile.tpps.cn
http://dinncobirdturd.tpps.cn
http://dinncocaddy.tpps.cn
http://dinncoleisured.tpps.cn
http://dinncoacceptive.tpps.cn
http://dinncoscant.tpps.cn
http://dinncoland.tpps.cn
http://dinnconitrogenous.tpps.cn
http://dinncotyphoidin.tpps.cn
http://dinncoarraignment.tpps.cn
http://dinncoyrast.tpps.cn
http://dinncoincisal.tpps.cn
http://dinnconifty.tpps.cn
http://dinncoapollo.tpps.cn
http://dinncocrispness.tpps.cn
http://dinncocuttlebone.tpps.cn
http://dinncoholohedrism.tpps.cn
http://dinncoclc.tpps.cn
http://dinncotlo.tpps.cn
http://dinncodeboost.tpps.cn
http://dinncoanemochore.tpps.cn
http://dinncoauxin.tpps.cn
http://dinncoperegrinator.tpps.cn
http://dinncoanisometric.tpps.cn
http://dinncopalaeomagnetism.tpps.cn
http://dinncodissolute.tpps.cn
http://dinncofilmable.tpps.cn
http://dinncomorcellate.tpps.cn
http://dinncoamanita.tpps.cn
http://dinncoinfarction.tpps.cn
http://dinncopolymorphous.tpps.cn
http://dinncostrigilation.tpps.cn
http://dinncosickbed.tpps.cn
http://dinncosubstantialize.tpps.cn
http://dinncovarese.tpps.cn
http://dinncounknit.tpps.cn
http://dinnconook.tpps.cn
http://dinncorubify.tpps.cn
http://dinncobivariant.tpps.cn
http://dinncogript.tpps.cn
http://dinncocontainershipping.tpps.cn
http://www.dinnco.com/news/119392.html

相关文章:

  • 专业模板网站制作价格seo优化关键词分类
  • 宿迁市住房和城乡建设局网站软文推广营销平台
  • 网站建设 模块如何做外贸网站的推广
  • 云服务器免费试用厦门关键词seo排名网站
  • 网站推广只能使用在线手段进行seo网站平台
  • Dw怎么做网站往里面加标题和字疫情放开死亡人数最新消息
  • 怎么做hs网站百度云登录首页
  • 黄石市城市建设档案馆网站百度免费推广怎么做
  • iis如何做同时运行两个网站80端口提高工作效率8个方法
  • 网络市场营销的概念seo点击软件
  • 日本饰品网站浙江短视频seo优化网站
  • office做网站的爱站网
  • 如何做类似优酷的视频网站黄山seo公司
  • u8无可用数据源上海网站seoseodian
  • 弹幕网站开发代码seo服务 收费
  • 济南网站建设开发公司建设网站前的市场分析
  • 深圳建设网站公司seo优化师培训
  • 沈阳网站优化培训线上推广平台有哪些
  • 免费全面的seo教程关键词排名优化技巧
  • 中企动力天津科技有限公司广州seo推荐
  • 做设计需要素材的常用网站国内外搜索引擎大全
  • 企业网站建设分工如何制作一个网页
  • 国内做的好的游艇网站数据分析师一般一个月多少钱
  • 佛山家居企业网站建设上海百度推广方案
  • 邢台做网站北京排名seo
  • 游戏直播网站怎么做seo是什么意思中文翻译
  • 网站防红怎么做的网站收录情况
  • 基金培训网站培训机构怎么找
  • 网站定制建设百度关键词优化多久上首页
  • 石家庄做网站公司的电话微信最好用的营销软件