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

别人做的网站怎么打开百度最容易收录的网站

别人做的网站怎么打开,百度最容易收录的网站,统计来源网站 列出域名及带来的独立ip数,社群营销案例Java Arrays.sort(数组) //排序 不讲究顺序的解答,都可以考虑一下排序是否可行。 39. 组合总和 错误解答 在写的时候需要注意,sum - candidates[i];很重要,也是回溯的一部分。 解答重复了。是因为回溯的for循环理解错了。 class Solutio…

Java

Arrays.sort(数组) //排序
不讲究顺序的解答,都可以考虑一下排序是否可行。

39. 组合总和

错误解答

在写的时候需要注意,sum -= candidates[i];很重要,也是回溯的一部分。
解答重复了。是因为回溯的for循环理解错了。

class Solution {List<List<Integer>> res = new ArrayList<List<Integer>>();public List<List<Integer>> combinationSum(int[] candidates, int target) {backtracking(candidates, target, 0, 0);return res;}List<Integer> path = new ArrayList<>();public void backtracking(int[] candidates, int target, int sum, int index) {if(sum > target) {return;}if(sum == target) {res.add(new ArrayList<>(path));return;}for(int i=0; i<candidates.length; i++) {sum += candidates[i];path.add(candidates[i]);backtracking(candidates,target,sum,i);sum -= candidates[i];path.remove(path.size()-1);}}
}

在这里插入图片描述

正确

  • 修改成下面这样就对了
    在这里插入图片描述

优化

不讲究顺序的解答,都可以考虑一下排序是否可行。
剪枝要先排序。

class Solution {List<List<Integer>> res = new ArrayList<List<Integer>>();public List<List<Integer>> combinationSum(int[] candidates, int target) {Arrays.sort(candidates);backtracking(candidates, target, 0, 0);return res;}List<Integer> path = new ArrayList<>();public void backtracking(int[] candidates, int target, int sum, int index) {if(sum == target) {res.add(new ArrayList<>(path));return;}for(int i=index; i<candidates.length; i++) {sum += candidates[i];if (sum > target) break;path.add(candidates[i]);backtracking(candidates,target,sum,i);sum -= candidates[i];path.remove(path.size()-1);}}
}

40.组合总和II

想得太简单了……

class Solution {List<List<Integer>> res = new ArrayList<List<Integer>>();public List<List<Integer>> combinationSum2(int[] candidates, int target) {Arrays.sort(candidates);back(candidates,target,0,0);return res;}List<Integer> path = new ArrayList<>();void back(int[] candidates, int target, int sum, int index) {if(sum > target) return;if(sum == target) {res.add(new ArrayList(path));}for(int i=index; i<candidates.length; i++) {path.add(candidates[i]);sum+=candidates[i];back(candidates,target,sum,index+1);sum-=candidates[i];path.remove(path.size()-1);   }}
}

131.分割回文串

http://www.shuangfujiaoyu.com/news/22339.html

相关文章:

  • 单位做员工招退工在什么网站外链下载
  • 网站功能图创建app平台
  • 微网站销售网站设计与制作公司
  • 网页布局照着别的网站做会侵权吗如何做好平台推广
  • 日照专业网站开发公司晨阳seo
  • 专业网站设计速寻亿企邦百度爱采购推广平台
  • 樟木头镇仿做网站今日头条极速版官网
  • 产品网站建设哪个好搜索引擎优化分析
  • 做网站运维编写网页的软件
  • 建设营销型网站的要素网络营销外包推广价格
  • 温州模板网站建站seo营销论文
  • 国家重点项目建设部网站关键词有哪些
  • 免费网络密码班级优化大师怎么加入班级
  • 网站首页图片大全推广引流渠道
  • 网站续费方案网站推广方案策划
  • 南京网站设南京网站设计计优化大师是什么意思
  • 郑州市建设厅网站seo客服
  • 网站开发设计作业及代码凡科建站代理登录
  • 模板网站建设方案seo推广优化排名软件
  • 网站开发存在的风险推广计划书范文
  • 沈阳制作公司网站最好用的免费建站平台
  • 政府门户网站建设策划怎么优化一个网站
  • 找人做个网站需要多少钱网站设计需要什么
  • google网站怎么做流量百度文库网页版登录入口
  • 做医疗网站需要百度seo关键词排名查询
  • 无锡响应式网站建设教育培训网站
  • 网站运营名词解释建一个外贸独立站大约多少钱
  • 个人建设门户网站 如何备案合肥网站制作
  • 月夜影院网站自然排名怎么优化
  • 沧州高端网站建设杭州seo整站优化