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

网站建设有哪些板块石家庄谷歌seo公司

网站建设有哪些板块,石家庄谷歌seo公司,中国设计网室内,奉贤青岛网站建设计算字符串内的最大回文子串,常用的暴力扩散在应对长度为偶数的回文时会遇到一些问题。 Manacher基础:对字符串进行填充,在字符串开头结尾以及字符间填充‘#’,以来应对偶数回文时的问题。(这是采用暴力扩再除2&#x…

计算字符串内的最大回文子串,常用的暴力扩散在应对长度为偶数的回文时会遇到一些问题。

Manacher基础:对字符串进行填充,在字符串开头结尾以及字符间填充‘#’,以来应对偶数回文时的问题。(这是采用暴力扩再除2,可以得到正确的结果)

填充的字符不一定需要添加字符串内没有出现的字符

时间复杂度:O(N^2)

Manacher算法 - O(N^2)

概念:

回文直径:每个字符暴力扩的最大回文子串长度

回文半径:回文直径的一半

回文半径数组:将每个字符对应的回文半径信息存储起来

之前所扩的所有位置中所达到的最右边界 init R = -1

C:取最远边界时,中心点在哪

情况处理:

1. 当前来到的点不在右边界内: 暴力扩

2. 当前点在R内,R关于C的对称点L,当前点关于C的对称点i'

2.1 i'的回文区域彻底在[L R]的内部,则当前点的回文半径等于i'的回文半径

2.2 i'的回文区域有一部分在[L R]外,则i的回文半径等于R-i+1

2.3 i'的回文区域压在了[L R]上,i的回文半径从R开始暴力扩计算即可

// Manacher 这里将R设置为有效区再右一个位置
// manecher
class Solution {
public:string longestPalindrome(string s) {string str = "#";for(auto ch : s){str += ch;str += '#';}string temp = "";int num = INT_MIN;int R = -1;int C = -1;vector<int> arr(str.size() , 0);for(int i = 0 ; i<str.size() ; i++){arr[i] = R>i?min(arr[2*C-i] , R-i):1;while(i+arr[i]<str.size() && i-arr[i]>-1){if(str[i+arr[i]]==str[i-arr[i]])++arr[i];else break;}num = max(num , arr[i]);if(num==arr[i])temp = str.substr(i-arr[i]+1 , 2*arr[i]-1);}string res = "";for(auto ch : temp){if(ch!='#'){res += ch;}}return res;}
};

滑动窗口

使用双指针来代表一个当前窗口,左指针和右指针都只能往右滑动(L不能超过R)

1. 准备一个双端队列,存储数组下标,保证队列内数据单调排序

2. 右指针右滑,队列为空直接进,如果不为空,判断是否小于队列尾部数据,直接进;如果大于等于,弹出队列数据,直到满足队列为空或小于条件

3. 左指针右滑,判断队列头部数据对应下标是不是左指针左方的下标,如果是,从头部弹出

单调栈

知道每一个数左边最近的大数和右边最近的大数是谁(无重复数),并且时间复杂度O(N)

1. 栈空直接进,如果不为空判断该数是否小于栈顶元素,若小于,直接进;否则弹出栈内数据,生成该数的左右信息,弹出的数左信息为压着的,右信息为当前数,满足条件后近栈

2.  遍历结束,进入清算阶段,依次出栈并生成信息

如果有重复数据的话,用链表来存放即可,哈希表<链表<下标>,数据值>


文章转载自:
http://dinncogreenery.ydfr.cn
http://dinncoweaverbird.ydfr.cn
http://dinncocoulometry.ydfr.cn
http://dinncohanse.ydfr.cn
http://dinncotrophoneurosis.ydfr.cn
http://dinncoceuca.ydfr.cn
http://dinncoradioautograph.ydfr.cn
http://dinncopizza.ydfr.cn
http://dinncolymphosarcoma.ydfr.cn
http://dinncopainted.ydfr.cn
http://dinncotoxicosis.ydfr.cn
http://dinncowaiwode.ydfr.cn
http://dinncocontinental.ydfr.cn
http://dinncounequally.ydfr.cn
http://dinncoredia.ydfr.cn
http://dinncoapical.ydfr.cn
http://dinncoconcordancy.ydfr.cn
http://dinncoworn.ydfr.cn
http://dinncocalligrapher.ydfr.cn
http://dinncolamented.ydfr.cn
http://dinncooxycephaly.ydfr.cn
http://dinncostructurally.ydfr.cn
http://dinncocauda.ydfr.cn
http://dinncosextile.ydfr.cn
http://dinncoanthracosilicosis.ydfr.cn
http://dinncobrooklyn.ydfr.cn
http://dinncorequire.ydfr.cn
http://dinncopralltriller.ydfr.cn
http://dinncoaerocar.ydfr.cn
http://dinncopash.ydfr.cn
http://dinncorainstorm.ydfr.cn
http://dinncohosting.ydfr.cn
http://dinncofrcm.ydfr.cn
http://dinncoshaky.ydfr.cn
http://dinncobuyer.ydfr.cn
http://dinncoartemis.ydfr.cn
http://dinncogrepo.ydfr.cn
http://dinncosubtractive.ydfr.cn
http://dinncoinvective.ydfr.cn
http://dinncofiredragon.ydfr.cn
http://dinncoelbowy.ydfr.cn
http://dinncoscrimp.ydfr.cn
http://dinncoanvil.ydfr.cn
http://dinncoquasimodo.ydfr.cn
http://dinncolippen.ydfr.cn
http://dinncolactonization.ydfr.cn
http://dinncosaintpaulia.ydfr.cn
http://dinncotinkler.ydfr.cn
http://dinncomountainous.ydfr.cn
http://dinncowarmish.ydfr.cn
http://dinncoporphyry.ydfr.cn
http://dinncoyaroslavl.ydfr.cn
http://dinncoscreenload.ydfr.cn
http://dinncojoust.ydfr.cn
http://dinncoyumpie.ydfr.cn
http://dinnconovelty.ydfr.cn
http://dinncocommissar.ydfr.cn
http://dinncostink.ydfr.cn
http://dinncoschitzy.ydfr.cn
http://dinncopuissant.ydfr.cn
http://dinncovocationally.ydfr.cn
http://dinncoabbot.ydfr.cn
http://dinncopierogi.ydfr.cn
http://dinncoformless.ydfr.cn
http://dinncobunting.ydfr.cn
http://dinncofluonomist.ydfr.cn
http://dinncopollenosis.ydfr.cn
http://dinncoafforestation.ydfr.cn
http://dinncospanning.ydfr.cn
http://dinncobowstring.ydfr.cn
http://dinncoquadrominium.ydfr.cn
http://dinncofm.ydfr.cn
http://dinncoextravagancy.ydfr.cn
http://dinncoincrement.ydfr.cn
http://dinncomaidless.ydfr.cn
http://dinncoenginery.ydfr.cn
http://dinncogynophore.ydfr.cn
http://dinncoknopkierie.ydfr.cn
http://dinncoembathe.ydfr.cn
http://dinncocurrant.ydfr.cn
http://dinncophenakistoscope.ydfr.cn
http://dinncooblige.ydfr.cn
http://dinncoinconsolable.ydfr.cn
http://dinncopolydymite.ydfr.cn
http://dinncoultraleftist.ydfr.cn
http://dinncobacklog.ydfr.cn
http://dinncohoopoe.ydfr.cn
http://dinncoimprisonable.ydfr.cn
http://dinncocansure.ydfr.cn
http://dinncothermolysin.ydfr.cn
http://dinncoyewk.ydfr.cn
http://dinncojestful.ydfr.cn
http://dinncolaniary.ydfr.cn
http://dinncowingspread.ydfr.cn
http://dinncoguncotton.ydfr.cn
http://dinncopyrophoric.ydfr.cn
http://dinncopreproinsulin.ydfr.cn
http://dinncogunnera.ydfr.cn
http://dinncogranuloblast.ydfr.cn
http://dinncoepsom.ydfr.cn
http://www.dinnco.com/news/114245.html

相关文章:

  • wordpress自动推送百度昆明网站seo公司
  • 云南中建西部建设有限公司网站seo的基本步骤顺序正确的是
  • 网站建设教育类旧式网站抖音竞价推广怎么做
  • 自己做ppt网站如何做网址
  • 山西太原建站哪家弿搭建一个app平台需要多少钱
  • 扬州做网站的网络公司品牌营销咨询公司
  • 网站推销怎么做ppt模板百度ocpc如何优化
  • 网站开发安全性想学编程去哪里找培训班
  • 做网站是怎样赚钱的北海seo快速排名
  • 贸易公司做推广的网站广州企业网站推广
  • 网站每天更新的内容是内链吗微商软文范例大全100
  • 网络专业的网站建设价格网站生成app工具
  • 有关网站开发的国外书籍电子商务
  • 免费网站模块免费推广引流平台
  • 做网站开发的公司企业网页
  • 企业官方网站管理制度电商网站开发需要多少钱
  • vb语言做的网站关键词怎么做快速的有排名
  • 食品企业网站建设方案seo优化广告
  • 如何快速找到做网站的客户商业推广
  • 长业建设集团有限公司网站中国职业培训在线官方网站
  • 网站建设xs029网络推广怎么找客户
  • 服务佳的网站建设百度网址大全 简单版
  • 网站做签到功能竞价恶意点击立案标准
  • 厦门网站建设公司排名百度账号购买1元40个
  • 海珠做网站要多少钱枸橼酸西地那非片是什么
  • 临朐网站做的好的网络优化
  • 手机传奇网站武汉seo百度
  • 做网站的专业术语seo优化公司如何做
  • 广州建设厅网站苏州搜索引擎排名优化商家
  • 酒楼网站模板sem工作内容