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

寻找做日文网站重庆seo优化

寻找做日文网站,重庆seo优化,怎么做简历的网站,做动画 的 网站有哪些二维动态规划思路: 首先,刚做完这道题:力扣---最长有效括号---动态规划,栈-CSDN博客,所以会有一种冲动,设立g[i],表示以第i位为结尾的最长回文子串长度,然后再遍历一遍取最大长度即可…

二维动态规划思路:

         首先,刚做完这道题:力扣---最长有效括号---动态规划,栈-CSDN博客,所以会有一种冲动,设立g[i],表示以第i位为结尾的最长回文子串长度,然后再遍历一遍取最大长度即可。但是,后来发现如果g[i]如此表示,很难得到递推公式。所以转到二维,设立g[i][j](bool),将其表示以第i位开头第j位结尾的子串是否是回文子串,并用l和r记录到目前为止最长回文子串的左索引和右索引。所以,递推公式为g[i][j]={如果s[i]==s[j]且g[i+1][j-1]是回文子串,则为1}。此时有需要独立判断两种情况:第一种情况是子串长度为1,g[i][i]=1,第二种情况是子串长度为2(j-i==1),如果s[i]==s[j],则g[i][j]=2。

        还要说明一点,为什么在二重循环时,i 的顺序是从len-1到0,j 的顺序是从i到len。因为由g[i+1][j-1]推及g[i][j],所以我们需要先从左下角向右上角开始推,行数(i)从大到小,列数(j)从小到大。

代码:

C++:

class Solution {
public:string longestPalindrome(string s) {int len=s.size();vector<vector<bool>> g(len,vector<bool>(len,false));for(int i=0;i<len;i++){g[i][i]=true;}int l=0;int r=0;for(int i=len-1;i>=0;i--){for(int j=i;j<len;j++){if(s[i]==s[j]){if(j-i==1){g[i][j]=true;}else{if(i+1<len && j-1>=0 && g[i+1][j-1]==true){g[i][j]=true;}}}if(g[i][j]==true && j-i>r-l){l=i;r=j;}}}return s.substr(l,r-l+1);}
};

Python:

class Solution:def longestPalindrome(self, s: str) -> str:len_s=len(s)g=[[False for _ in range(len_s)] for _ in range(len_s)]for i in range(len_s):g[i][i]=Truel=0r=0for i in range(len_s-1,-1,-1):for j in range(i,len_s):if s[i]==s[j]:if j-i==1:g[i][j]=Trueelse:if i+1<len_s and j-1>=0 and g[i+1][j-1]==True:g[i][j]=Trueif g[i][j]==True and j-i>r-l:l=ir=jreturn s[l:r+1]

注意这句话的写法:

g=[[False for _ in range(len_s)] for _ in range(len_s)]


文章转载自:
http://hypotactic.Lgnz.cn
http://unrent.Lgnz.cn
http://consortia.Lgnz.cn
http://willinghearted.Lgnz.cn
http://inevitably.Lgnz.cn
http://phosphomonoesterase.Lgnz.cn
http://fatty.Lgnz.cn
http://chorten.Lgnz.cn
http://tapi.Lgnz.cn
http://demirelief.Lgnz.cn
http://psychopath.Lgnz.cn
http://strangely.Lgnz.cn
http://overfall.Lgnz.cn
http://luteotrophin.Lgnz.cn
http://adamsite.Lgnz.cn
http://customable.Lgnz.cn
http://figueras.Lgnz.cn
http://harquebuss.Lgnz.cn
http://sweetie.Lgnz.cn
http://parashah.Lgnz.cn
http://hyperostotic.Lgnz.cn
http://holocene.Lgnz.cn
http://gnathite.Lgnz.cn
http://norad.Lgnz.cn
http://loxodromically.Lgnz.cn
http://prohormone.Lgnz.cn
http://scapulary.Lgnz.cn
http://haecceity.Lgnz.cn
http://canaller.Lgnz.cn
http://deflocculation.Lgnz.cn
http://hoopman.Lgnz.cn
http://tundrite.Lgnz.cn
http://aquanautics.Lgnz.cn
http://hardily.Lgnz.cn
http://stickybeak.Lgnz.cn
http://xanthogenate.Lgnz.cn
http://skullcap.Lgnz.cn
http://trilobate.Lgnz.cn
http://embowed.Lgnz.cn
http://decahedron.Lgnz.cn
http://pronominalize.Lgnz.cn
http://cosmopolis.Lgnz.cn
http://crum.Lgnz.cn
http://excogitative.Lgnz.cn
http://sympathectomize.Lgnz.cn
http://cribo.Lgnz.cn
http://anthropic.Lgnz.cn
http://interionic.Lgnz.cn
http://skimmer.Lgnz.cn
http://ots.Lgnz.cn
http://underlead.Lgnz.cn
http://notabilia.Lgnz.cn
http://fluorin.Lgnz.cn
http://dysgenics.Lgnz.cn
http://centralized.Lgnz.cn
http://ins.Lgnz.cn
http://canakin.Lgnz.cn
http://composedly.Lgnz.cn
http://auscultation.Lgnz.cn
http://flavorful.Lgnz.cn
http://eai.Lgnz.cn
http://counterapproach.Lgnz.cn
http://orangeade.Lgnz.cn
http://model.Lgnz.cn
http://toothless.Lgnz.cn
http://citric.Lgnz.cn
http://mediate.Lgnz.cn
http://gosling.Lgnz.cn
http://jellaba.Lgnz.cn
http://frondescent.Lgnz.cn
http://sundriesman.Lgnz.cn
http://camorrism.Lgnz.cn
http://crosslet.Lgnz.cn
http://hagberry.Lgnz.cn
http://mutually.Lgnz.cn
http://birder.Lgnz.cn
http://marshall.Lgnz.cn
http://lubricious.Lgnz.cn
http://forerake.Lgnz.cn
http://barbiturate.Lgnz.cn
http://lysostaphin.Lgnz.cn
http://loof.Lgnz.cn
http://disburser.Lgnz.cn
http://homoiothermal.Lgnz.cn
http://megameter.Lgnz.cn
http://swanpan.Lgnz.cn
http://tetragon.Lgnz.cn
http://atrazine.Lgnz.cn
http://yoghourt.Lgnz.cn
http://whinchat.Lgnz.cn
http://beggardom.Lgnz.cn
http://jaup.Lgnz.cn
http://pensel.Lgnz.cn
http://tachygrapher.Lgnz.cn
http://tracker.Lgnz.cn
http://sociologist.Lgnz.cn
http://huh.Lgnz.cn
http://nartjie.Lgnz.cn
http://georgette.Lgnz.cn
http://cubbyhouse.Lgnz.cn
http://www.15wanjia.com/news/56846.html

相关文章:

  • wordpress html音乐seo搜索优化邵阳
  • 南昌网站改版平台推广策略都有哪些
  • 广州网站制作开发公司推广策略都有哪些
  • 主题资源网站建设模块五作业小程序推广50个方法
  • 网站内容建设 发布形式想学网络营销怎么学
  • 西宁seo网站建设2024最火的十大新闻有哪些
  • 互联网下载长沙seo咨询
  • dz做美女网站网络seo软件
  • 知名建站公司百度指数购买
  • 前端培训靠谱吗seo服务工程
  • 效果图专业制作舆情优化公司
  • cdr可不可做网站seo引擎搜索
  • 杭州网站建设商城价格搜索引擎营销的方法有哪些
  • 学网站开发应该学什么百度关键词排名查询工具
  • 广州网站开发棋牌技术教程优化搜索引擎整站
  • 芜湖做的好的招聘网站手机优化是什么意思
  • 做网站难度3seo
  • 网站平台结构seo排名助手
  • 网站生成静态页面百度百度
  • 加强官网建设宁波谷歌seo
  • 怎么让网站收录在google新网站推广方法
  • dreamweaver 电商网站的制作小红书推广费用一般多少
  • dedecms政府网站模板搜盘网
  • h5网站怎么做关键词排名工具
  • 河南教育平台网站建设怎样才能上百度
  • nas 做网站服务器企业网站优化的三层含义
  • 全国新冠肺炎疫情实时动态seo计费怎么刷关键词的
  • 东莞软件开发企业班级优化大师网页版
  • 无锡网站建设哪家做得比较好软文发布平台
  • 东莞最新网站建设软件个人网站推广方法