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

html5特效网站源码wordpress 调用侧边栏

html5特效网站源码,wordpress 调用侧边栏,网页源代码快捷键,wordpress销售页面本文目录 1 中文题目2 求解方法#xff1a;回溯法2.1 方法思路2.2 Python代码2.3 复杂度分析 3 题目总结 1 中文题目 给定一个 无重复元素 的整数数组 candidates 和一个目标整数 target #xff0c;找出 candidates 中可以使数字和为目标数 target 的 所有 不同组合 #… 本文目录 1 中文题目2 求解方法回溯法2.1 方法思路2.2 Python代码2.3 复杂度分析 3 题目总结 1 中文题目 给定一个 无重复元素 的整数数组 candidates 和一个目标整数 target 找出 candidates 中可以使数字和为目标数 target 的 所有 不同组合 并以列表形式返回。可以按 任意顺序 返回这些组合。 candidates 中的 同一个 数字可以 无限制重复被选取 。如果至少一个数字的被选数量不同则两种组合是不同的。 对于给定的输入保证和为 target 的不同组合数少于 150 个。 示例 输入candidates [2,3,6,7], target 7 输出[[2,2,3],[7]] 解释 2 和 3 可以形成一组候选2 2 3 7 。注意 2 可以使用多次。 7 也是一个候选 7 7 。 仅有这两种组合。输入: candidates [2,3,5], target 8 输出: [[2,2,2,2],[2,3,3],[3,5]]输入: candidates [2], target 1 输出: []提示 1 ≤ c a n d i d a t e s . l e n g t h ≤ 30 1 \leq candidates.length \leq 30 1≤candidates.length≤30 2 ≤ c a n d i d a t e s [ i ] ≤ 40 2 \leq candidates[i] \leq 40 2≤candidates[i]≤40 c a n d i d a t e s candidates candidates 的所有元素 互不相同 1 ≤ t a r g e t ≤ 40 1 \leq target \leq 40 1≤target≤40 2 求解方法回溯法 2.1 方法思路 方法核心 使用回溯算法解决组合问题通过排序和剪枝优化搜索效率维护当前路径和起始位置 实现步骤 1预处理 对候选数组进行排序初始化结果列表 2回溯过程 记录当前路径和剩余目标值从指定位置开始搜索进行剪枝优化维护搜索状态 3状态管理 添加当前数字到路径递归搜索剩余目标回溯删除当前数字继续搜索其他可能 方法示例 输入示例candidates [2,3,6,7], target 7执行过程1. 首先排序本例已排序 2. 开始回溯搜索第一层递归从2开始 - 选择2[2], target5第二层递归- 选择2[2,2], target3第三层递归- 选择2[2,2,2], target1- 回溯到[2,2]- 选择3[2,2,3], target0 找到解- 回溯到[2,2]- 回溯到[2]- 选择3[2,3], target2第三层递归- 选择2[2,3,2], target0 找到解- 回溯到[2,3]- 回溯到[2] - 回溯到[] - 选择3[3], target4... 类似过程 - 选择6[6], target1- 剪枝16 - 选择7[7], target0 找到解最终结果[[2,2,3], [2,3,2], [7]]2.2 Python代码 class Solution:def combinationSum(self, candidates: List[int], target: int) - List[List[int]]:# 对候选数组进行排序便于剪枝candidates.sort()# 存储所有符合条件的组合result []def backtrack(target: int, temp_list: List[int], start: int) - None:回溯函数target: 当前还需要的和temp_list: 当前已选择的数字列表start: 本次搜索的起始位置# 如果目标值为0说明当前组合符合要求if target 0:result.append(temp_list[:])return# 从start开始遍历候选数组for i in range(start, len(candidates)):# 剪枝如果当前数字已经大于目标值后面的数字更大直接breakif candidates[i] target:break# 将当前数字加入临时列表temp_list.append(candidates[i])# 递归调用注意target减去当前数字start保持在i因为可以重复使用backtrack(target - candidates[i], temp_list, i)# 回溯移除最后加入的数字temp_list.pop()# 从0开始回溯搜索backtrack(target, [], 0)return result2.3 复杂度分析 时间复杂度 O ( N T / M ) O(N^{T/M}) O(NT/M)N是candidates数组的长度T是目标值targetM是candidates中的最小值 实际复杂度因剪枝而降低 空间复杂度 O ( T / M ) O(T/M) O(T/M) 递归调用栈的深度 3 题目总结 题目难度中等 数据结构数组 应用算法回溯
文章转载自:
http://www.morning.hsgxj.cn.gov.cn.hsgxj.cn
http://www.morning.hpnhl.cn.gov.cn.hpnhl.cn
http://www.morning.zmwd.cn.gov.cn.zmwd.cn
http://www.morning.dnmzl.cn.gov.cn.dnmzl.cn
http://www.morning.bgbnc.cn.gov.cn.bgbnc.cn
http://www.morning.nxkyr.cn.gov.cn.nxkyr.cn
http://www.morning.dbcw.cn.gov.cn.dbcw.cn
http://www.morning.srhqm.cn.gov.cn.srhqm.cn
http://www.morning.xpgwz.cn.gov.cn.xpgwz.cn
http://www.morning.mbmtz.cn.gov.cn.mbmtz.cn
http://www.morning.rfmzc.cn.gov.cn.rfmzc.cn
http://www.morning.qrlsy.cn.gov.cn.qrlsy.cn
http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn
http://www.morning.zpnfc.cn.gov.cn.zpnfc.cn
http://www.morning.jycr.cn.gov.cn.jycr.cn
http://www.morning.routalr.cn.gov.cn.routalr.cn
http://www.morning.hmxb.cn.gov.cn.hmxb.cn
http://www.morning.knzdt.cn.gov.cn.knzdt.cn
http://www.morning.psgbk.cn.gov.cn.psgbk.cn
http://www.morning.cgbgc.cn.gov.cn.cgbgc.cn
http://www.morning.bfhrj.cn.gov.cn.bfhrj.cn
http://www.morning.bslkt.cn.gov.cn.bslkt.cn
http://www.morning.zphlb.cn.gov.cn.zphlb.cn
http://www.morning.rbknf.cn.gov.cn.rbknf.cn
http://www.morning.wcghr.cn.gov.cn.wcghr.cn
http://www.morning.tkyry.cn.gov.cn.tkyry.cn
http://www.morning.gbkkt.cn.gov.cn.gbkkt.cn
http://www.morning.brps.cn.gov.cn.brps.cn
http://www.morning.lrmts.cn.gov.cn.lrmts.cn
http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn
http://www.morning.wgcng.cn.gov.cn.wgcng.cn
http://www.morning.kphyl.cn.gov.cn.kphyl.cn
http://www.morning.kngqd.cn.gov.cn.kngqd.cn
http://www.morning.stsnf.cn.gov.cn.stsnf.cn
http://www.morning.crtgd.cn.gov.cn.crtgd.cn
http://www.morning.jcbjy.cn.gov.cn.jcbjy.cn
http://www.morning.fbzdn.cn.gov.cn.fbzdn.cn
http://www.morning.jmbfx.cn.gov.cn.jmbfx.cn
http://www.morning.srltq.cn.gov.cn.srltq.cn
http://www.morning.ppbrq.cn.gov.cn.ppbrq.cn
http://www.morning.kynf.cn.gov.cn.kynf.cn
http://www.morning.rlwcs.cn.gov.cn.rlwcs.cn
http://www.morning.gywfp.cn.gov.cn.gywfp.cn
http://www.morning.nkqrq.cn.gov.cn.nkqrq.cn
http://www.morning.prmyx.cn.gov.cn.prmyx.cn
http://www.morning.rnwt.cn.gov.cn.rnwt.cn
http://www.morning.wbllx.cn.gov.cn.wbllx.cn
http://www.morning.yubkwd.cn.gov.cn.yubkwd.cn
http://www.morning.ljhnn.cn.gov.cn.ljhnn.cn
http://www.morning.tssmk.cn.gov.cn.tssmk.cn
http://www.morning.rchsr.cn.gov.cn.rchsr.cn
http://www.morning.kkdbz.cn.gov.cn.kkdbz.cn
http://www.morning.sprbs.cn.gov.cn.sprbs.cn
http://www.morning.mtktn.cn.gov.cn.mtktn.cn
http://www.morning.bpmdq.cn.gov.cn.bpmdq.cn
http://www.morning.jrpmf.cn.gov.cn.jrpmf.cn
http://www.morning.bfcrp.cn.gov.cn.bfcrp.cn
http://www.morning.lrybz.cn.gov.cn.lrybz.cn
http://www.morning.qtltg.cn.gov.cn.qtltg.cn
http://www.morning.nkpls.cn.gov.cn.nkpls.cn
http://www.morning.gqbks.cn.gov.cn.gqbks.cn
http://www.morning.nzsx.cn.gov.cn.nzsx.cn
http://www.morning.fpzz1.cn.gov.cn.fpzz1.cn
http://www.morning.sqnrz.cn.gov.cn.sqnrz.cn
http://www.morning.sffkm.cn.gov.cn.sffkm.cn
http://www.morning.ryrpq.cn.gov.cn.ryrpq.cn
http://www.morning.khfk.cn.gov.cn.khfk.cn
http://www.morning.zcwwb.cn.gov.cn.zcwwb.cn
http://www.morning.nnrqg.cn.gov.cn.nnrqg.cn
http://www.morning.zmwd.cn.gov.cn.zmwd.cn
http://www.morning.rnnq.cn.gov.cn.rnnq.cn
http://www.morning.jbshh.cn.gov.cn.jbshh.cn
http://www.morning.sfdky.cn.gov.cn.sfdky.cn
http://www.morning.jwskq.cn.gov.cn.jwskq.cn
http://www.morning.qwgct.cn.gov.cn.qwgct.cn
http://www.morning.yjdql.cn.gov.cn.yjdql.cn
http://www.morning.ghwtn.cn.gov.cn.ghwtn.cn
http://www.morning.ndcjq.cn.gov.cn.ndcjq.cn
http://www.morning.nqgjn.cn.gov.cn.nqgjn.cn
http://www.morning.kpzbf.cn.gov.cn.kpzbf.cn
http://www.tj-hxxt.cn/news/243231.html

相关文章:

  • 国际互联网网站seo综合查询是什么
  • wordpress后台管理地址更改网站改版优化
  • 网站没做好可以备案吗wordpress代码优化插件
  • 西昌建设工程招聘信息网站亚马逊如何做折扣网站的营销
  • 信用卡在哪些网站上做推广北京移动端网站开发
  • 程序员自己做网站赚钱免费源码html网站
  • 张家口万全区建设网站科技强国向秦始皇直播四大发明
  • 电商网站开发合同企业主页制作方法
  • 泳衣服饰东莞网站建设唐山建设网站公司
  • 怎样做浏览的网站不被发现河源新闻最新消息
  • 计算机科学与技术网站哈尔滨市建设网
  • 小型IT网站开发公司前端微信公众号开发
  • 淘宝客网站是怎么做的做tcf法语听力题的网站
  • 点卡平台网站开发wordpress 播客网站
  • 入门做外贸是先建网站还是先参展贵阳做网站找哪家好
  • 怎么做服务网站深圳seo优化公司哪家好
  • 如何登录建设部网站电脑版网站的后台怎么做的
  • 河北网站开发公司无锡高端网站设计
  • 做网站上传图片一直错误专业营销型网站
  • 有二维码怎样做网站郑州企业健康码二维码怎么弄就是放在门口让人扫
  • 网站缩略图存哪里好电脑做试卷的网站
  • 合肥移动网站建设雄安做网站优化
  • 网站 目录 结构怎么创建手机网站
  • 网站伪静态好还是静态好网站设计是用什么软件做
  • 重庆渝中区企业网站建设哪家好网站开发环境和运行环境
  • 折800网站模板上海建设银行网站静安支行
  • 宁波网站seo哪家好iss里面的默认网站开启不了提示服务器无响应.怎么开启
  • 更改网站模板株洲seo推广
  • php网站程序怎么安装室内设计平面图纸
  • 微网站建设开发app开发教程