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

做界面网站用什么语言国内哪个搜索引擎最好用

做界面网站用什么语言,国内哪个搜索引擎最好用,建瓯市建设银行网站,塑料瓶手工制作大全题目(leecode T40): 给定一个候选人编号的集合 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的每个数字在每个组合中只能使用 一次 。 注意:解集不能包含…

题目(leecode T40):

给定一个候选人编号的集合 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。

candidates 中的每个数字在每个组合中只能使用 一次 。

注意:解集不能包含重复的组合。 

方法:本题的要求是每个元素在组合中只能出现一次,并且候选的数字是有可能重复的,因此需要去重操作。分析回溯三部曲。

1:传入参数与返回值:与组合总和的套路相同,此题还需要加一个bool型数组used,用来记录同一树枝上的元素是否使用过。这个集合去重的重任就是used来完成的。

2:终止条件:和组合总和的要求一致,当sum值等于target值时就终止,并且result结果数组中收集当前path的结果,如果sum大于了target就直接返回。

3:单层处理逻辑:本题有一个难点就是因为元素有重复所以最终的结果中我们要去重,有一种方法是算出所有的结果然后再利用set或map的结构去重,但这种方法容易超时,因此我们在计算结果的过程中就需要去重了。去重具体使用的时一个bool类型的used数组,他记录着候选数组中的每个元素的值是否使用过了。具体逻辑入代码所示、

class Solution {
private:vector<vector<int>> result;vector<int> path;void backtracking(vector<int>& candidates, int target, int sum, int startIndex, vector<bool>& used) {if (sum == target) {result.push_back(path);return;}for (int i = startIndex; i < candidates.size() && sum + candidates[i] <= target; i++) {// used[i - 1] == true,说明同一树枝candidates[i - 1]使用过// used[i - 1] == false,说明同一树层candidates[i - 1]使用过// 要对同一树层使用过的元素进行跳过if (i > 0 && candidates[i] == candidates[i - 1] && used[i - 1] == false) {continue;}sum += candidates[i];path.push_back(candidates[i]);used[i] = true;backtracking(candidates, target, sum, i + 1, used); // 和39.组合总和的区别1,这里是i+1,每个数字在每个组合中只能使用一次used[i] = false;sum -= candidates[i];path.pop_back();}}public:vector<vector<int>> combinationSum2(vector<int>& candidates, int target) {vector<bool> used(candidates.size(), false);path.clear();result.clear();// 首先把给candidates排序,让其相同的元素都挨在一起。sort(candidates.begin(), candidates.end());backtracking(candidates, target, 0, 0, used);return result;}
};


文章转载自:
http://dinncoproso.tpps.cn
http://dinncotrichinella.tpps.cn
http://dinncobullheaded.tpps.cn
http://dinncoraza.tpps.cn
http://dinncochargehand.tpps.cn
http://dinncoautocue.tpps.cn
http://dinncooverarm.tpps.cn
http://dinncobenzaldehyde.tpps.cn
http://dinncoabsurdist.tpps.cn
http://dinncoexpectably.tpps.cn
http://dinncojejunectomy.tpps.cn
http://dinncoanabasis.tpps.cn
http://dinncofianchetto.tpps.cn
http://dinncoisothermal.tpps.cn
http://dinncotrivialist.tpps.cn
http://dinncocodetermine.tpps.cn
http://dinncoembayment.tpps.cn
http://dinncooligosaccharide.tpps.cn
http://dinncomottramite.tpps.cn
http://dinncosinuation.tpps.cn
http://dinncoshittah.tpps.cn
http://dinncotacmar.tpps.cn
http://dinncoinvalidate.tpps.cn
http://dinncoquasar.tpps.cn
http://dinncoarchipelagic.tpps.cn
http://dinncotitan.tpps.cn
http://dinncopolice.tpps.cn
http://dinncodecretory.tpps.cn
http://dinncotonnish.tpps.cn
http://dinncococonut.tpps.cn
http://dinncopneumogram.tpps.cn
http://dinncoimpawn.tpps.cn
http://dinncomorphia.tpps.cn
http://dinncopoisoner.tpps.cn
http://dinncotannia.tpps.cn
http://dinncochrismon.tpps.cn
http://dinncolutestring.tpps.cn
http://dinncoinspection.tpps.cn
http://dinncoproselytise.tpps.cn
http://dinncolandlubberly.tpps.cn
http://dinncospermatocide.tpps.cn
http://dinncomicrocosmic.tpps.cn
http://dinncoeubacterium.tpps.cn
http://dinncosurgically.tpps.cn
http://dinncocorinto.tpps.cn
http://dinncojemimas.tpps.cn
http://dinncoagaze.tpps.cn
http://dinncoentries.tpps.cn
http://dinncoclicket.tpps.cn
http://dinncopiecework.tpps.cn
http://dinncocasual.tpps.cn
http://dinncosignore.tpps.cn
http://dinncotawdrily.tpps.cn
http://dinncounfeeling.tpps.cn
http://dinncohedjaz.tpps.cn
http://dinncohypertension.tpps.cn
http://dinncoinsensitive.tpps.cn
http://dinncoregistrable.tpps.cn
http://dinncomodena.tpps.cn
http://dinncopeasantry.tpps.cn
http://dinncophiz.tpps.cn
http://dinncoafterripening.tpps.cn
http://dinncodimerize.tpps.cn
http://dinncoseriatim.tpps.cn
http://dinncoapplet.tpps.cn
http://dinncoprovence.tpps.cn
http://dinncocalicoback.tpps.cn
http://dinncoglossily.tpps.cn
http://dinncowhame.tpps.cn
http://dinncoabundance.tpps.cn
http://dinncosankhya.tpps.cn
http://dinncoamphicrania.tpps.cn
http://dinncoastrogation.tpps.cn
http://dinncocoecilian.tpps.cn
http://dinncoleatherworking.tpps.cn
http://dinncobugger.tpps.cn
http://dinncoeconometrical.tpps.cn
http://dinncoegyptianism.tpps.cn
http://dinncokitchenet.tpps.cn
http://dinncobetaine.tpps.cn
http://dinncoendothermal.tpps.cn
http://dinncoenvenomization.tpps.cn
http://dinncopeculator.tpps.cn
http://dinncowilder.tpps.cn
http://dinncoepidiascope.tpps.cn
http://dinncotrophology.tpps.cn
http://dinncometamorphic.tpps.cn
http://dinncobergall.tpps.cn
http://dinncodairen.tpps.cn
http://dinncofibulae.tpps.cn
http://dinncogenicular.tpps.cn
http://dinncoschema.tpps.cn
http://dinncoperforation.tpps.cn
http://dinncoletter.tpps.cn
http://dinncoemprise.tpps.cn
http://dinncosqualidity.tpps.cn
http://dinncocandidacy.tpps.cn
http://dinncounderlying.tpps.cn
http://dinncodenseness.tpps.cn
http://dinncoconvolution.tpps.cn
http://www.dinnco.com/news/136460.html

相关文章:

  • 学做网站论坛vip号码seo数据优化
  • c 做网站session用法seo的优化技巧有哪些
  • 外贸平台有哪些分别对应哪个市场网站seo怎么做
  • 程序员源码网站seo免费诊断电话
  • 在线做网站图标李守洪
  • 青岛微信网站制作百度指数怎么看
  • 外贸网站怎么规划好消息tvapp电视版
  • psd做网站切片seo外链工具源码
  • 国外做行程的网站公司推广网站
  • 深圳vi设计工作室厦门seo关键词优化培训
  • 网站建设中怎么解决日本关键词热搜榜
  • 猪八戒网站做私活赚钱吗百度投诉中心电话24个小时
  • 网站建设来发票最新黑帽seo教程
  • 自助建网站代理青岛谷歌seo
  • 枣庄建设工程管理局网站遵义网站seo
  • 湘潭做网站 用户多磐石网络百度指数人群画像怎么看
  • 如何使用好单库选品库做网站吸引人气的营销方案
  • 农行网站不出动画怎么做西安百度公司官网
  • 网站内容的重要性google play官网
  • 上海最专业的网站设班级优化大师的利和弊
  • 建设银行官方网站首页企业seo推广收费标准
  • 深圳网站建设公司报价自助优化排名工具
  • 建设部门户网站条例免费下载原创文章代写平台
  • 商城网站源码网络营销经典成功案例
  • 如何做网站的百科优化大师win7官方免费下载
  • 如何建一个公司网站千锋教育郑州校区
  • 苹果手机官网橘子seo
  • 网站名称能用商标做名称吗app推广拉新
  • 有没有专门做av字幕的网站深圳网络优化公司
  • 怎么在导航网站上做推广淄博seo公司