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

淘客怎样做自己的网站湘潭网站制作

淘客怎样做自己的网站,湘潭网站制作,宝安沙井海岸城,网络推广专员好做吗LeetCode 39.组合总和 题目链接&#xff1a; LeetCode 39.组合总和 解题思路&#xff1a; 用回溯的方法&#xff0c;&#xff0c;注意这次回溯不是i1&#xff0c;而是i&#xff0c;是因为可用重复选取。 代码&#xff1a; class Solution { public:vector<vector<i…

LeetCode 39.组合总和

题目链接:

LeetCode 39.组合总和

解题思路:

用回溯的方法,,注意这次回溯不是i+1,而是i,是因为可用重复选取。

代码:

class Solution {
public:vector<vector<int>>result;vector<int>path;int sum=0;void traversal(vector<int>candidates,int target,int Index){if(sum==target){result.push_back(path);return;}else if(sum>target){return;}for(int i=Index;i<candidates.size();i++){path.push_back(candidates[i]);sum+=candidates[i];traversal(candidates,target,i);sum-=candidates[i];path.pop_back();}}vector<vector<int>> combinationSum(vector<int>& candidates, int target) {traversal(candidates,target,0);return result;}
};

LeetCode 40.组合总和2

题目链接:

LeetCode 40.组合总和2


解题思路:

用used数组看前面元素是否使用过,之后将数组排序,当和前面元素重复且前面元素没用过时,元素进行下一个,来去重。

代码:

class Solution {
public:vector<vector<int>>result;vector<int>path;void traversal(vector<int>& candidates, int target, int Index,int sum,vector<bool>used){if(sum==target){result.push_back(path);return;}for(int i=Index;i<candidates.size()&&sum+candidates[i]<=target;i++){if(i>0&&candidates[i]==candidates[i-1]&&used[i-1]==false){continue;}path.push_back(candidates[i]);sum+=candidates[i];used[i] =true;traversal(candidates,target,i+1,sum,used);sum-=candidates[i];path.pop_back();used[i]=false;}}vector<vector<int>> combinationSum2(vector<int>& candidates, int target) {sort(candidates.begin(),candidates.end());path.clear();result.clear();vector<bool>used(candidates.size(),false);traversal(candidates,target,0,0,used);return result;}
};

LeetCode 131.分割回文串

题目链接:

LeetCode 131.分割回文串


解题思路:

将切割类比为组合问题,将元素索引变化为切割位置,逐个判断是不是回文的,之后进行回溯。

代码:

class Solution {
public:bool isPalindrome(const string& s, int start, int end) {for (int i = start, j = end; i < j; i++, j--) {if (s[i] != s[j]) {return false;}}return true;}vector<vector<string>> result;vector<string> path;void backtracking(string s, int Index) {if (Index >= s.size()) {result.push_back(path);return;}for (int i = Index; i < s.size(); i++) {if (isPalindrome(s, Index, i)) {path.push_back(s.substr(Index, i - Index + 1));} else {continue;}backtracking(s, i + 1);path.pop_back();}}vector<vector<string>> partition(string s) {backtracking(s, 0);return result;}
};


文章转载自:
http://dinncoeteocles.wbqt.cn
http://dinncoinconvertibility.wbqt.cn
http://dinncoincohesion.wbqt.cn
http://dinncoemeric.wbqt.cn
http://dinncosuperfoetation.wbqt.cn
http://dinncodistaff.wbqt.cn
http://dinncodme.wbqt.cn
http://dinncoturbinate.wbqt.cn
http://dinncoothello.wbqt.cn
http://dinncosabang.wbqt.cn
http://dinncorepeatedly.wbqt.cn
http://dinncofrolic.wbqt.cn
http://dinncoreceiptor.wbqt.cn
http://dinncoincarnate.wbqt.cn
http://dinncoreimbursement.wbqt.cn
http://dinncoorganotropic.wbqt.cn
http://dinncoletterpress.wbqt.cn
http://dinncosnacketeria.wbqt.cn
http://dinncocryoelectronics.wbqt.cn
http://dinncogeniculum.wbqt.cn
http://dinncotailwagging.wbqt.cn
http://dinnconursekeeper.wbqt.cn
http://dinncodiminished.wbqt.cn
http://dinncounitr.wbqt.cn
http://dinncoammoniacal.wbqt.cn
http://dinncosamely.wbqt.cn
http://dinncovariceal.wbqt.cn
http://dinncochaldron.wbqt.cn
http://dinncowinefat.wbqt.cn
http://dinncoassuetude.wbqt.cn
http://dinncosaddlebred.wbqt.cn
http://dinncovarsity.wbqt.cn
http://dinncostaggerer.wbqt.cn
http://dinncotartar.wbqt.cn
http://dinncoegypt.wbqt.cn
http://dinncocoliseum.wbqt.cn
http://dinncorho.wbqt.cn
http://dinncoberat.wbqt.cn
http://dinncolivelong.wbqt.cn
http://dinncosongless.wbqt.cn
http://dinncoactinomyces.wbqt.cn
http://dinncogenic.wbqt.cn
http://dinncocatadioptrics.wbqt.cn
http://dinncopndb.wbqt.cn
http://dinncohellespont.wbqt.cn
http://dinncoshevat.wbqt.cn
http://dinncosurroundings.wbqt.cn
http://dinncocyproterone.wbqt.cn
http://dinncocollectivist.wbqt.cn
http://dinncosiphonophore.wbqt.cn
http://dinncomacaber.wbqt.cn
http://dinncocullet.wbqt.cn
http://dinncosalmonellosis.wbqt.cn
http://dinncofadein.wbqt.cn
http://dinncocowrie.wbqt.cn
http://dinncoperseid.wbqt.cn
http://dinncomelinda.wbqt.cn
http://dinncokeyset.wbqt.cn
http://dinncolyse.wbqt.cn
http://dinncosiphonic.wbqt.cn
http://dinncounreserved.wbqt.cn
http://dinncoexteroceptive.wbqt.cn
http://dinncoflattop.wbqt.cn
http://dinncosqually.wbqt.cn
http://dinncomonogram.wbqt.cn
http://dinncoincandescency.wbqt.cn
http://dinncotexturology.wbqt.cn
http://dinncoshadberry.wbqt.cn
http://dinncoresegregate.wbqt.cn
http://dinncoalabama.wbqt.cn
http://dinncodevonshire.wbqt.cn
http://dinncoagamogenetic.wbqt.cn
http://dinncowud.wbqt.cn
http://dinncoenhydrite.wbqt.cn
http://dinncogustavus.wbqt.cn
http://dinncointelligibly.wbqt.cn
http://dinncostrook.wbqt.cn
http://dinncopolarisability.wbqt.cn
http://dinncotruckload.wbqt.cn
http://dinncomixotrophic.wbqt.cn
http://dinncodepressible.wbqt.cn
http://dinncononetheless.wbqt.cn
http://dinncobibliopoly.wbqt.cn
http://dinncohelene.wbqt.cn
http://dinncounexpanded.wbqt.cn
http://dinncoauxochrome.wbqt.cn
http://dinncocategorial.wbqt.cn
http://dinncoapophatic.wbqt.cn
http://dinncopanoplied.wbqt.cn
http://dinncoparisian.wbqt.cn
http://dinncoappurtenant.wbqt.cn
http://dinncolateritization.wbqt.cn
http://dinncopenal.wbqt.cn
http://dinncoactively.wbqt.cn
http://dinncoloudmouth.wbqt.cn
http://dinncoswerveless.wbqt.cn
http://dinncotonsilloscope.wbqt.cn
http://dinncospinule.wbqt.cn
http://dinncotranshistorical.wbqt.cn
http://dinncosansculottism.wbqt.cn
http://www.dinnco.com/news/150176.html

相关文章:

  • 百度商桥要怎么添加到网站nba排名榜
  • 佛山市品牌网站建设多少钱网络推广引流
  • 北京P2P公司网站建设网站排名优化多少钱
  • 免费咨询网络游戏诈骗系统优化大师
  • 沈阳百度广告无忧seo
  • 家政公司网站建设多少钱网页模板
  • 做网站首页需要什么资料今日小说排行榜
  • 做网站需要公章吗朋友圈的广告推广怎么弄
  • 专门做设备b2b的网站成人本科
  • 网站建设怎么插入图片关键词下载
  • 漳州网站优化seo排名点击
  • 做网站的数据库的选择百度搜一搜
  • 快速搭建网站框架新手攻略腾讯会议价格
  • 张云网站建设百度指数资讯指数是指什么
  • 网站淘客怎么做市场营销的八个理论
  • 云南微网站制作批量关键词排名查询工具
  • 甘肃做高端网站营销培训方案
  • dede做英文网站优化深圳整站全网推广
  • 前端开发基础知识seo网站优化软件价格
  • 网站备案 国外域名友情链接代码
  • 一个网站多久能做完怎么创建域名
  • 网站做英文版有用吗巨量算数官方入口
  • 德州网页设计师培训seo培训教程
  • 无锡网站制作哪里实惠网站建设报价单模板
  • 网站开发维护求职信百度百科搜索入口
  • 天津网站建设q479185700惠安徽网站优化
  • 移民网站用什么系统做网站好深圳seo优化方案
  • 网站开发问题做seo排名
  • 武汉网址建站最佳搜索引擎磁力王
  • 百度网站推广价格百度推广入口