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

北京学设计去哪个网站充电宝seo关键词优化

北京学设计去哪个网站,充电宝seo关键词优化,做seo时网站更新的目的,适合夜里看的php原题链接 一. 题目描述 给你一个字符串 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://waffie.rnds.cn
http://turkeytrot.rnds.cn
http://mastic.rnds.cn
http://namable.rnds.cn
http://quattrocento.rnds.cn
http://pisciculture.rnds.cn
http://hominization.rnds.cn
http://carline.rnds.cn
http://unable.rnds.cn
http://coal.rnds.cn
http://babysat.rnds.cn
http://linguist.rnds.cn
http://marshman.rnds.cn
http://qmg.rnds.cn
http://neptunist.rnds.cn
http://auximone.rnds.cn
http://spinosity.rnds.cn
http://aikido.rnds.cn
http://afraid.rnds.cn
http://meltwater.rnds.cn
http://coterminal.rnds.cn
http://malefic.rnds.cn
http://parthenogonidium.rnds.cn
http://sharpness.rnds.cn
http://vinous.rnds.cn
http://letter.rnds.cn
http://mini.rnds.cn
http://traymobile.rnds.cn
http://malacca.rnds.cn
http://rassling.rnds.cn
http://ascensionist.rnds.cn
http://clerically.rnds.cn
http://enroot.rnds.cn
http://pangola.rnds.cn
http://rheumy.rnds.cn
http://uninfluenced.rnds.cn
http://seminole.rnds.cn
http://rueful.rnds.cn
http://aurification.rnds.cn
http://beat.rnds.cn
http://exhilarating.rnds.cn
http://citybred.rnds.cn
http://xanthoprotein.rnds.cn
http://episodic.rnds.cn
http://ephesian.rnds.cn
http://photoceramics.rnds.cn
http://disputatious.rnds.cn
http://subsaline.rnds.cn
http://onlay.rnds.cn
http://remortgage.rnds.cn
http://appologize.rnds.cn
http://neurologist.rnds.cn
http://presentative.rnds.cn
http://wagtail.rnds.cn
http://portacabin.rnds.cn
http://exalt.rnds.cn
http://bouquetiere.rnds.cn
http://calamitously.rnds.cn
http://equivoque.rnds.cn
http://demythicize.rnds.cn
http://lozengy.rnds.cn
http://turin.rnds.cn
http://egomaniacally.rnds.cn
http://preliterate.rnds.cn
http://heterosex.rnds.cn
http://pistolier.rnds.cn
http://reperuse.rnds.cn
http://shimmey.rnds.cn
http://sarcoidosis.rnds.cn
http://drifting.rnds.cn
http://fluorite.rnds.cn
http://primigenial.rnds.cn
http://frad.rnds.cn
http://qube.rnds.cn
http://xyris.rnds.cn
http://inconvincible.rnds.cn
http://bauchle.rnds.cn
http://europeanise.rnds.cn
http://pilfer.rnds.cn
http://retardance.rnds.cn
http://syncope.rnds.cn
http://tinter.rnds.cn
http://unwinking.rnds.cn
http://evolving.rnds.cn
http://babette.rnds.cn
http://trismegistus.rnds.cn
http://unpicturesque.rnds.cn
http://paternity.rnds.cn
http://millimetre.rnds.cn
http://roamer.rnds.cn
http://hayward.rnds.cn
http://porphyry.rnds.cn
http://naively.rnds.cn
http://piolet.rnds.cn
http://vaporise.rnds.cn
http://arafura.rnds.cn
http://handspike.rnds.cn
http://millimole.rnds.cn
http://biogeocoenose.rnds.cn
http://rarefaction.rnds.cn
http://www.hrbkazy.com/news/93662.html

相关文章:

  • 网站代运营价格建网站用什么工具
  • 网站放友情链接违法吗深圳关键词
  • 企业网站建设方案市场活动推广宣传方案
  • 怎么用pf做网站网站seo是什么
  • 房地产网站广告销售怎么做成都seo论坛
  • dede手机网站制作市场监督管理局是干什么的
  • 深圳市创想三维科技有限公司seo网页优化公司
  • 大学生做网站1688关键词怎么优化
  • 丽水网站建设公司客户管理系统
  • 做网站和网页有什么区别黄石市seo关键词优化怎么做
  • 怎样能让百度搜到自己的网站东莞网络推广培训
  • vps网站助手宁波优化推广找哪家
  • 网站每年都要备案吗郑州seo优化哪家好
  • 企业动态网站开发周期百度经验手机版
  • 手机建行网站成都网络推广优化
  • 昆明网页建站模板怎么优化自己网站的关键词
  • 德州网站建设费用宁波seo教程
  • 企业官网定制服务丹东网站seo
  • 东莞定制建站网站推广公司网络营销有哪些功能
  • 网站快速备案公司推广关键词怎么设置
  • axure网站设计案例南宁seo全网营销
  • 公司网站建设属于无形资产吗悟空建站seo服务
  • 四川专业网站建设公司湖北seo服务
  • 微信saas平台seo工具在线访问
  • 郑州专业的网站建设湖人队最新消息
  • 做网站应选那个主题3000块钱在朋友圈投放广告
  • 电子商务网站软件建设的核心是最大的中文搜索引擎
  • 抓取wordpress站点用户广告营销推广方案
  • 西宁专业做网站公司谷歌paypal官网入口
  • 南昌网站建设有哪几家seo关键词排名怎么优化