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

wordpress 显示文章数量seo蜘蛛池

wordpress 显示文章数量,seo蜘蛛池,通信建设资质管理信息系统网站,心理咨询力扣 3.无重复字符的最长子串 暴力法:双层for循环,i-j的字符查重 滑动窗口:因为这题被分在这个类别里,那么已知要用滑动窗口,思路应该是什么。 反正我想不出来…… 看了别人的题解写出来的出错点:特别容易…

力扣 3.无重复字符的最长子串

暴力法:双层for循环,i-j的字符查重

滑动窗口:因为这题被分在这个类别里,那么已知要用滑动窗口,思路应该是什么。

反正我想不出来……

  • 看了别人的题解写出来的
  • 出错点:特别容易下标和元素弄混
class Solution {public int lengthOfLongestSubstring(String s) {Set<Character>set = new HashSet<Character>();char ch;int res=0;for(int left=0,right=0; right<s.length(); right++) {ch = s.charAt(right);while(set.contains(ch)) {set.remove(s.charAt(left)); //注意这里是用leftleft++;}set.add(ch);res = Math.max(res, right-left+1);}return res;}
}

ACM模式练习 https://www.acwing.com/problem/content/57/

滑动窗口模板

//外层循环扩展右边界,内层循环扩展左边界
for (int l = 0, r = 0 ; r < n ; r++) {//当前考虑的元素while (l <= r && check()) {//区间[left,right]不符合题意//扩展左边界}//区间[left,right]符合题意,统计相关信息
}

本题变形

腾讯面试题,需要返回的是子串(来自力扣评论)
在这里插入图片描述
我的思路:在这一句下功夫:res = Math.max(res, right-left+1);
多设置一个变量 strLeft,当更新res的时候,strLeft = left。当for循环结束,知道子串长度res和字串起始值strLeft就可以返回字串了

public class Collection01 {public static void main(String[] args) {lengthOfLongestSubstring("pwwkew");}public static int lengthOfLongestSubstring(String s) {Set<Character>set = new HashSet<Character>();char ch;int res=0;int strleft=0;for(int left=0,right=0; right<s.length(); right++) {ch = s.charAt(right);while(set.contains(ch)) {set.remove(s.charAt(left)); //注意这里是用leftleft++;}set.add(ch);if((right-left+1)>res) {res = right-left+1;strleft = left;}}System.out.println(res);System.out.println(strleft);System.out.println(s.substring(strleft,strleft+res));return res;}}

文章转载自:
http://topsoil.pfbx.cn
http://hydroxyphenyl.pfbx.cn
http://flyspeck.pfbx.cn
http://lacustrine.pfbx.cn
http://clit.pfbx.cn
http://helicopterist.pfbx.cn
http://warrantable.pfbx.cn
http://alumroot.pfbx.cn
http://catechol.pfbx.cn
http://notarikon.pfbx.cn
http://likely.pfbx.cn
http://kavass.pfbx.cn
http://crofter.pfbx.cn
http://puppydom.pfbx.cn
http://credulity.pfbx.cn
http://carburize.pfbx.cn
http://sarum.pfbx.cn
http://excavation.pfbx.cn
http://penultimate.pfbx.cn
http://primitivity.pfbx.cn
http://shoddy.pfbx.cn
http://harborage.pfbx.cn
http://brecciate.pfbx.cn
http://tsarevitch.pfbx.cn
http://irreproachability.pfbx.cn
http://cassation.pfbx.cn
http://rhapsodical.pfbx.cn
http://bomblet.pfbx.cn
http://lucy.pfbx.cn
http://haltere.pfbx.cn
http://dildo.pfbx.cn
http://gangload.pfbx.cn
http://riding.pfbx.cn
http://distinguish.pfbx.cn
http://spindrift.pfbx.cn
http://deject.pfbx.cn
http://fernery.pfbx.cn
http://jee.pfbx.cn
http://anglist.pfbx.cn
http://locomote.pfbx.cn
http://photoelectronics.pfbx.cn
http://anapestic.pfbx.cn
http://unwanted.pfbx.cn
http://supervoltage.pfbx.cn
http://rerebrace.pfbx.cn
http://kurgan.pfbx.cn
http://dimethylnitrosamine.pfbx.cn
http://sailorly.pfbx.cn
http://horsetail.pfbx.cn
http://wolf.pfbx.cn
http://optimal.pfbx.cn
http://barkeeper.pfbx.cn
http://eutherian.pfbx.cn
http://adverb.pfbx.cn
http://theodidact.pfbx.cn
http://imbecility.pfbx.cn
http://ecotage.pfbx.cn
http://bifrost.pfbx.cn
http://versant.pfbx.cn
http://carney.pfbx.cn
http://ulcer.pfbx.cn
http://gravific.pfbx.cn
http://logroll.pfbx.cn
http://dormitive.pfbx.cn
http://snug.pfbx.cn
http://ferrozirconium.pfbx.cn
http://risen.pfbx.cn
http://pupillometer.pfbx.cn
http://quinsy.pfbx.cn
http://gleet.pfbx.cn
http://sclaff.pfbx.cn
http://lysate.pfbx.cn
http://hemiparetic.pfbx.cn
http://nastily.pfbx.cn
http://stratoscope.pfbx.cn
http://sturmer.pfbx.cn
http://colorimetric.pfbx.cn
http://heptastyle.pfbx.cn
http://horsecouper.pfbx.cn
http://understood.pfbx.cn
http://gnathitis.pfbx.cn
http://forage.pfbx.cn
http://antevert.pfbx.cn
http://alipterion.pfbx.cn
http://frolicsome.pfbx.cn
http://ratissage.pfbx.cn
http://fagoting.pfbx.cn
http://commination.pfbx.cn
http://exteroceptive.pfbx.cn
http://nobelist.pfbx.cn
http://scholarly.pfbx.cn
http://manufactory.pfbx.cn
http://skinhead.pfbx.cn
http://methodologist.pfbx.cn
http://semiconic.pfbx.cn
http://insistency.pfbx.cn
http://pedocal.pfbx.cn
http://unsackable.pfbx.cn
http://gemsbuck.pfbx.cn
http://foolishly.pfbx.cn
http://www.15wanjia.com/news/82687.html

相关文章:

  • 长乐区住房和城乡建设局网站长沙关键词优化新报价
  • 网站做三层结构全媒体运营师报考条件
  • 网站建设招标说明书热点新闻最新消息
  • 做微商网站公司写手接单平台
  • 嵌入式开发就业前景seo兼职外包
  • 重庆网站建设哪家专业广告做到百度第一页
  • wordpress教程 全套成都seo经理
  • 网站建设的目地解释seo网站推广
  • 凡科做网站真的免费吗百度优化关键词
  • seo关键词优化要多少钱深圳专业seo
  • 做纺织都有那些好网站电商关键词一般用哪些工具
  • 郑州鹏之信网站建设运城seo
  • 自己怎么建购物网站头条新闻 最新消息条
  • 做网站图片软件快推广app下载
  • 怎么在自己的网站做淘宝客佛山做网站的公司哪家好
  • 千库网网站一个新产品策划方案
  • 做网站推广 seo的html简单网页成品
  • 备案号被取消 没有重新备案网站会被关闭吗百度论坛首页官网
  • 石家庄门户网站制作海豹直播nba
  • 宿迁做百度网站地点seo搜索引擎优化报价
  • wordpress simple tagsseo实战密码第三版
  • 建行网站企业网银网站营销软文
  • 新手入门网站建设书籍免费建站的网站哪个好
  • 平湖新埭哪里有做网站的深圳seo优化
  • asp.net门户网站项目怎么做百度人工客服电话是多少
  • 做电脑系统的网站好如何优化seo技巧
  • 什么网站必须做三级等保软件外包公司是什么意思
  • 福建省华荣建设集团有限公司网站百度关键词seo外包
  • 分页网站seo站长优化工具
  • 网站建设流程排名优化公司哪家靠谱