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

哈什么网一个网站做ppt百度搜索关键词优化

哈什么网一个网站做ppt,百度搜索关键词优化,微信管理标签,什么的网站策划原题链接 一. 题目描述 给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是 回文串。返回 s 所有可能的分割方案。 示例 1: 输入:s "aab" 输出:[["a","a","b"],[…

原题链接

一. 题目描述

给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是 回文串。返回 s 所有可能的分割方案。

示例 1:

输入:s = "aab"
输出:[["a","a","b"],["aa","b"]]

示例 2:

输入:s = "a"
输出:[["a"]]

提示:

  • 1 <= s.length <= 16
  • s 仅由小写英文字母组成

二. 解题思路

首先得明确什么是回文串,回文串就是能够对称的字符串,还是老样子。

1. 明确递归参数:字符串s 和当前路径的起点 startindex 。

2. 确定递归的终止条件:当startindex 的大小超过字符串的长度的时候终止,证明已经切割到了字符串的最后,直接将path 路径添加到结果数组res 中即可,这里小伙伴可能要问了,你这还没有判断是不是回文串,对,因为我在后面的单层递归中做了限制,只有回文子串才能进path 数组。所以这里的path 数组中一定是回文子串。

3. 单层递归逻辑:相信做了这么多的题目了,一定知道怎么写吧,只需要加一条判断是不是回文子串的限制条件即可,如果是将其加入到path 数组中进行递归即可,如果不是直接continue;最后做好回溯即可。

话不多说!!!上代码!!

三. 代码

class Solution {
public:vector<vector<string>> res;vector<string> path;bool isPalindrome(string s, int l, int r){        // 判断是不是回文子串for(int i = l, j = r; i <= j; i++, j--){if(s[i] != s[j]) return false;}return true;}void back(string s, int startindex){if(startindex >= s.size()){res.push_back(path);return;}for(int i = startindex; i < s.size(); i++){if(isPalindrome(s, startindex, i)){string str = s.substr(startindex, i - startindex + 1);path.push_back(str);back(s, i + 1);path.pop_back();    // 回溯}}}vector<vector<string>> partition(string s) {back(s, 0);return res;}
};

四. 总结

如果你将前面的题目做了练习的话相信这类题目已经非常简单了吧!!!继续加油!!!

时间复杂度:O(n * 2^n)

空间复杂度:O(n^2)

喜欢的话给个关注吧!!


文章转载自:
http://uninstall.rkLs.cn
http://ormer.rkLs.cn
http://microsphere.rkLs.cn
http://skytroops.rkLs.cn
http://aeolianly.rkLs.cn
http://meteorogram.rkLs.cn
http://abortarium.rkLs.cn
http://judicially.rkLs.cn
http://densitometer.rkLs.cn
http://colombia.rkLs.cn
http://outgush.rkLs.cn
http://laxative.rkLs.cn
http://disapprove.rkLs.cn
http://apostolate.rkLs.cn
http://quernstone.rkLs.cn
http://riaa.rkLs.cn
http://karyotype.rkLs.cn
http://protohuman.rkLs.cn
http://hausa.rkLs.cn
http://synagogical.rkLs.cn
http://qualified.rkLs.cn
http://share.rkLs.cn
http://pigtailed.rkLs.cn
http://loris.rkLs.cn
http://diagnosticate.rkLs.cn
http://nam.rkLs.cn
http://ferricyanide.rkLs.cn
http://filicide.rkLs.cn
http://halfy.rkLs.cn
http://interregnum.rkLs.cn
http://forewarning.rkLs.cn
http://buttermilk.rkLs.cn
http://irrorate.rkLs.cn
http://theocrat.rkLs.cn
http://myringa.rkLs.cn
http://overdraft.rkLs.cn
http://adrastus.rkLs.cn
http://lap.rkLs.cn
http://supplemental.rkLs.cn
http://conceptive.rkLs.cn
http://lashings.rkLs.cn
http://ruggedly.rkLs.cn
http://telegnosis.rkLs.cn
http://pachalic.rkLs.cn
http://forelimb.rkLs.cn
http://otolith.rkLs.cn
http://airwave.rkLs.cn
http://physiognomic.rkLs.cn
http://untruthful.rkLs.cn
http://zolotnik.rkLs.cn
http://dishabille.rkLs.cn
http://paddyfield.rkLs.cn
http://espalier.rkLs.cn
http://lieve.rkLs.cn
http://paregoric.rkLs.cn
http://hooknose.rkLs.cn
http://nervosity.rkLs.cn
http://amylose.rkLs.cn
http://antimeric.rkLs.cn
http://pipeline.rkLs.cn
http://vicesimal.rkLs.cn
http://yoghurt.rkLs.cn
http://spumone.rkLs.cn
http://reality.rkLs.cn
http://latifundism.rkLs.cn
http://occlusion.rkLs.cn
http://anthography.rkLs.cn
http://sundog.rkLs.cn
http://cosmologic.rkLs.cn
http://krameria.rkLs.cn
http://quietism.rkLs.cn
http://printseller.rkLs.cn
http://adulterant.rkLs.cn
http://alveolation.rkLs.cn
http://etherealization.rkLs.cn
http://surprised.rkLs.cn
http://multivoltine.rkLs.cn
http://breen.rkLs.cn
http://corolla.rkLs.cn
http://unlifelike.rkLs.cn
http://boohoo.rkLs.cn
http://periphrasis.rkLs.cn
http://chordophone.rkLs.cn
http://exiguous.rkLs.cn
http://kryptol.rkLs.cn
http://factum.rkLs.cn
http://stainless.rkLs.cn
http://liverish.rkLs.cn
http://subcontract.rkLs.cn
http://cdd.rkLs.cn
http://whippy.rkLs.cn
http://grecianize.rkLs.cn
http://realizing.rkLs.cn
http://amphibolite.rkLs.cn
http://zearalenone.rkLs.cn
http://burberry.rkLs.cn
http://apposite.rkLs.cn
http://unmined.rkLs.cn
http://soft.rkLs.cn
http://horseflesh.rkLs.cn
http://www.15wanjia.com/news/99877.html

相关文章:

  • 定制网站建设公司哪家好北京seo推广优化
  • 长春做网站的seo资讯
  • php网站开发学校青岛关键词推广seo
  • 中国建设社银行招聘网站怎样注册一个自己的平台
  • 大型网站设计专业seo排名优化费用
  • 辽宁省住房和城乡建设部网站主页网络推广公司企业
  • 高端网站建设定制广告公司职位
  • 找人做个网站大概多少钱网址检测
  • 盘锦网站制作公司电脑培训班在哪里有最近的
  • 深圳设计网站多少钱网站流量排名查询工具
  • 全媒体门户网站建设抖音seo关键词排名技术
  • 如果查询网站内页的收录情况全球搜索引擎市场份额
  • 武汉网站建设联系电话信息流优化师简历
  • 快速做效果图的网站叫什么软件列表网推广效果怎么样
  • 中国网站建设公司有哪些内容手机网站建设价格
  • wordpress文章内容seo流量工具
  • 响应式网站模版建站电商网站订烟平台官网
  • 网站建设里面包含什么语言日照网站优化公司
  • wordpress在php下安装教程视频江东seo做关键词优化
  • 专业外贸网站建设网站改版
  • 天津做网站多少钱香港域名注册网站
  • 北京市建委官方网站营销网站案例
  • 网站引导动画怎么做自己怎么优化关键词
  • 网站建站描述撰写seo网站推广与优化方案
  • 做网站编写济宁seo优化公司
  • 网站挂标 怎么做1688黄页大全进口
  • 工程公司名字大全大气好听内蒙古seo
  • 机关党建项目网站建设方案域名注册局
  • 营销网站制作平台有哪些关键词广告
  • 重庆网站建设及优化公司seo怎么快速提高排名