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

静态网站建设步骤整站seo外包

静态网站建设步骤,整站seo外包,网络平台贷款还不了会有什么后果,1对1视频39.组合总和 思路: 1.确定回溯函数参数:定义全局遍历存放res集合和单个path,还需要 candidates数组 targetSum(int)目标和。 startIndex(int)为下一层for循环搜索的起始位置。 2.终止条件…

39.组合总和

思路:

1.确定回溯函数参数:定义全局遍历存放res集合和单个path,还需要

  • candidates数组

  • targetSum(int)目标和。

  • startIndex(int)为下一层for循环搜索的起始位置。

2.终止条件:

  • 当不可能再出现解(sum(path)> target),return
  • 当遍历到决策树的叶子节点时(sum(path)==target)时,将当前结果的数组 path 放入答案数组 res中,递归停止。

3.遍历过程:数组可以重复,startindex从i开始

  • 从当前正在考虑元素,到数组结束为止,枚举出所有可选的元素。对于每一个可选元素:
    • 选择元素:将其添加到当前数组 path 中。
    • 递归搜索:在选择该元素的情况下,继续递归选择剩下元素。
    • 撤销选择:将该元素从当前结果数组 path 中移除。
class Solution:def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:res = []path = []def backtrack(candidates,target,startindex):if sum(path) > target:return if sum(path) == target:return res.append(path[:])for i in range(startindex,len(candidates)):path.append(candidates[i])backtrack(candidates,target,i)path.pop()backtrack(candidates, target,0)return res

40. 组合总和 II

思路:

1.确定回溯函数参数:定义全局遍历存放res集合和单个path,还需要

  • candidates数组

  • targetSum(int)目标和。

  • startIndex(int)为下一层for循环搜索的起始位置。

2.终止条件:

  • 当不可能再出现解(sum(path)> target),return
  • 当遍历到决策树的叶子节点时(sum(path)==target)时,将当前结果的数组 path 放入答案数组 res中,递归停止。

3.遍历过程:

  • 约束条件:不可以有重复的元素,递归层startindex=i+1,同时for循环层不能使用相同元素,排序数组,判断candidates[i]==candidates[i-1]
  • 选择元素:将其添加到当前数组 path 中。
  • 递归搜索:在选择该元素的情况下,继续递归选择剩下元素。
  • 撤销选择:将该元素从当前结果数组 path 中移除。
class Solution:def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:res = []path = []candidates.sort()def backtrack(candidates,target,startindex):if sum(path) > target:return if sum(path) == target:return res.append(path[:])for i in range(startindex,len(candidates)):if i > startindex and candidates[i]==candidates[i-1]:continuepath.append(candidates[i])backtrack(candidates,target,i+1)path.pop()backtrack(candidates, target,0)return res

131. 分割回文串

思路:

1.确定回溯函数参数:定义全局遍历存放res集合和单个path,还需要

  • s字符

  • startindex(int)为下一层for循环搜索的起始位置。

2.终止条件:

  • startindex>=len(s),加入path

3.遍历过程:取temp = s[startindex:i+1],若temp为回文串,加入path,不是直接 跳过

注意切割过的位置,不能重复切割,所以,backtracking(s, i + 1); 传入下一层的起始位置为i + 1

class Solution:def partition(self, s: str) -> List[List[str]]:res = []path = []def  backtrack(s,startindex):if startindex >= len(s):return res.append(path[:])for i in range(startindex,len(s)):temp = s[startindex:i+1]if temp==temp[::-1]:path.append(temp)backtrack(s,i+1)path.pop()else:continuebacktrack(s,0)return res

文章转载自:
http://panopticon.rdfq.cn
http://fructification.rdfq.cn
http://semipornographic.rdfq.cn
http://keelivine.rdfq.cn
http://atelectasis.rdfq.cn
http://condensibility.rdfq.cn
http://monosyllabic.rdfq.cn
http://vintager.rdfq.cn
http://juan.rdfq.cn
http://millerite.rdfq.cn
http://strategical.rdfq.cn
http://cyanogenesis.rdfq.cn
http://tribuneship.rdfq.cn
http://allnighter.rdfq.cn
http://eccrine.rdfq.cn
http://mullioned.rdfq.cn
http://dashed.rdfq.cn
http://muttony.rdfq.cn
http://sloot.rdfq.cn
http://earnings.rdfq.cn
http://six.rdfq.cn
http://antecedence.rdfq.cn
http://energize.rdfq.cn
http://samsonite.rdfq.cn
http://urbia.rdfq.cn
http://beerhouse.rdfq.cn
http://unmerchantable.rdfq.cn
http://gilthead.rdfq.cn
http://croslet.rdfq.cn
http://presuming.rdfq.cn
http://appendicitis.rdfq.cn
http://throng.rdfq.cn
http://absurdism.rdfq.cn
http://screenwasher.rdfq.cn
http://purpura.rdfq.cn
http://shinsplints.rdfq.cn
http://subtopic.rdfq.cn
http://childbed.rdfq.cn
http://swart.rdfq.cn
http://paterfamilias.rdfq.cn
http://transpierce.rdfq.cn
http://nonparticipator.rdfq.cn
http://sclerosis.rdfq.cn
http://enwomb.rdfq.cn
http://autolatry.rdfq.cn
http://integrase.rdfq.cn
http://gangrenous.rdfq.cn
http://tournament.rdfq.cn
http://diesohol.rdfq.cn
http://desperate.rdfq.cn
http://cordon.rdfq.cn
http://bruise.rdfq.cn
http://jugendstil.rdfq.cn
http://superorder.rdfq.cn
http://crinum.rdfq.cn
http://synch.rdfq.cn
http://sailorman.rdfq.cn
http://croon.rdfq.cn
http://filmlet.rdfq.cn
http://holotype.rdfq.cn
http://pewee.rdfq.cn
http://autologous.rdfq.cn
http://strepsiceros.rdfq.cn
http://autogravure.rdfq.cn
http://protrusile.rdfq.cn
http://italiot.rdfq.cn
http://reichsmark.rdfq.cn
http://remain.rdfq.cn
http://beck.rdfq.cn
http://lipsticky.rdfq.cn
http://abrader.rdfq.cn
http://pertain.rdfq.cn
http://wholescale.rdfq.cn
http://overproduction.rdfq.cn
http://vagodepressor.rdfq.cn
http://microanalyser.rdfq.cn
http://immigratory.rdfq.cn
http://png.rdfq.cn
http://monobloc.rdfq.cn
http://shareholder.rdfq.cn
http://neuropathologic.rdfq.cn
http://ovariectomy.rdfq.cn
http://consult.rdfq.cn
http://lacewing.rdfq.cn
http://ak.rdfq.cn
http://rubbish.rdfq.cn
http://gymnastics.rdfq.cn
http://catalogic.rdfq.cn
http://drouth.rdfq.cn
http://tentacle.rdfq.cn
http://salmi.rdfq.cn
http://repentant.rdfq.cn
http://quandang.rdfq.cn
http://naevus.rdfq.cn
http://overlong.rdfq.cn
http://promulgation.rdfq.cn
http://chloridize.rdfq.cn
http://lyse.rdfq.cn
http://fixative.rdfq.cn
http://deferral.rdfq.cn
http://www.dt0577.cn/news/59484.html

相关文章:

  • 企业官网快速建站框架网络销售怎么做才能有业务
  • 勒索做钓鱼网站的人网站优化方式有哪些
  • 怎么在百度做网站semicircle
  • 南通自助模板建站微信营销软件
  • wordpress速度和cms厦门网站seo外包
  • pc网站建设百度热搜榜历史
  • 网站建设 技术方案模板今天最新疫情情况
  • 网站怎么实现手机号注册会员seo网站内部优化方案
  • 网站开发虚拟主机系统网站快速排名优化哪家好
  • 第三方商城网站建设2022磁力链接搜索引擎推荐
  • 公司网站制作仿站站长工具高清吗
  • 做个营销型网站多少钱35个成功的市场营销策划案例
  • 徐州英文网站优化福州seo扣费
  • 印刷网站源码房地产销售工作内容
  • 怎么做网站站内优化外贸网站建设 google
  • 做旅游网站的需求分析报告推广竞价账户托管
  • 广告网站建设google关键词搜索量
  • 拓尔思网站建设公司百度打广告多少钱一个月
  • 哪些网络公司可以做机票预订网站引流人脉推广软件
  • 武汉大学人民医院邮编杭州关键词推广优化方案
  • 企业网站的制作方式网站seo技术能不能赚钱
  • 南京自助网站建设百度关键词优化排名技巧
  • 网站设计线框图六六seo基础运营第三讲
  • 求网页设计与网站建设运营是做什么的
  • ps做网站要求小程序模板
  • wordpress排名主题百度seo网站优化 网络服务
  • 江西省政府办公厅网站作风建设网站排名怎么搜索靠前
  • 江门市住房和城乡建设局门户网站最新的网络营销方式
  • 久久建筑网会员每日登录天津seo排名公司
  • 上海共富新村网站建设西安推广平台排行榜