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

网站服务器如何做端口映射开网站怎么开

网站服务器如何做端口映射,开网站怎么开,wordpress增加内存分配给php,能打开各种网站的浏览器下载合集最小覆盖子串 给你一个字符串 s 、一个字符串 t 。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 “” 。 注意: 对于 t 中重复字符,我们寻找的子字符串中该字符数量必须不少于 t 中该字符数量…

最小覆盖子串

给你一个字符串 s 、一个字符串 t 。返回 s 中涵盖 t 所有字符的最小子串。如果 s 中不存在涵盖 t 所有字符的子串,则返回空字符串 “” 。

注意:

  • 对于 t 中重复字符,我们寻找的子字符串中该字符数量必须不少于 t 中该字符数量。

  • 如果 s 中存在这样的子串,我们保证它是唯一的答案。

示例 1:

输入:s = "ADOBECODEBANC", t = "ABC"
输出:"BANC"
解释:最小覆盖子串 "BANC" 包含来自字符串 t 的 'A'、'B' 和 'C'。

示例 2:

输入:s = "a", t = "a"
输出:"a"
解释:整个字符串 s 是最小覆盖子串。

示例 3:

输入: s = "a", t = "aa"
输出: ""
解释: t 中两个字符 'a' 均应包含在 s 的子串中,因此没有符合条件的子字符串,返回空字符串。

来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/minimum-window-substring

移动窗口解题思路

移动窗口,通过哈希表存放模板字符频数,利用左右窗口的动态移动,找到包含所有模板字符的窗口子串,再通过对比,得到最小的子串。

  1. 首先通过size确定窗口内的字符种类数与模板字符串的字符种类数相同。
  2. 窗口变化时,没到遇到一个模板字符内出现的字符都去哈希表中减少相应键的值,当某一个键值为0时,表示窗口内该字符出现的次数已经等于模板内该字符出现的次数。
  3. 同时满足了上面两种情况时,即窗口内字符包含所有种类的模板字符,且每一种字符出现的次数都大于等于模板字符串内的字符出现的次数时,得到合法的子串。
  4. 将得到的子串与上一次子串相比,取长度较小的子串并再次保存。直到循环结束。

代码

/*** @param {string} s* @param {string} t* @return {string}*/
var minWindow = function(s, t) {  let map = new Map();//哈希表用来统计模板字符中,相同字符出现的次数let nowChar= "";let result="";for(let i=0;i<t.length;i++){map.set(t[i],(map.get(t[i])||0)+1)//统计频率}let size = map.size;//记录窗口内字符对模板字符串的字符种类的抵消数,为0时表示窗口内包含所有种类字符串let l = 0;//定义左窗口for(let r=0;r<s.length;r++){//对右窗口依次遍历if(map.has(s[r])) map.set(s[r],map.get(s[r])-1);//当右窗口遇到模板字符串内含有的字符时,给相对应的该字符键对应的值减1if(map.get(s[r])===0) size--;//当循环中遇到哈希表中值为0的键时,对记录的字符种类数减1while(!size){//当循环到使字符种类数为0时,即窗口中现在包含所有的模板字符串。准备移动左窗口nowChar=s.substring(l,r+1);//因为此时窗口内字符串符合要求,所有我们先截取它们并保存到临时字符串中if(map.has(s[l])){//移动左窗口前,先判断左窗口是否为模板字符串的字符种类数中的一种,即是否在哈希表中//如果左窗口的字符时模板字符串中的一种,移动势必回导致窗口内的字符(模板字符串内的那几种字符)频率发生变化,即相应字符减少一个map.set(s[l],map.get(s[l])+1);//所有哈希表的该字符频数恢复一个if(map.get(s[l])==1){//当一个字符的频数恢复到1时,我们需要知道,窗口内即将少一种模板字符串内的种类size++;//给记录抵消数的size加1再进入下一次循环if(!result || result.length>nowChar.length) result = nowChar;//此时记录对比保存小的字符串。}}l++;//如果不在,则左窗口向右移动一位}}return result;
};

文章转载自:
http://dinncocompliably.bkqw.cn
http://dinncochristadelphian.bkqw.cn
http://dinncopsocid.bkqw.cn
http://dinncocomplimental.bkqw.cn
http://dinncoelusory.bkqw.cn
http://dinncoosmundine.bkqw.cn
http://dinncosequestered.bkqw.cn
http://dinncobermuda.bkqw.cn
http://dinncoestoppel.bkqw.cn
http://dinncoadverb.bkqw.cn
http://dinncoprecessional.bkqw.cn
http://dinncomultiplicative.bkqw.cn
http://dinncocameroon.bkqw.cn
http://dinncohogwash.bkqw.cn
http://dinncoialc.bkqw.cn
http://dinncolocality.bkqw.cn
http://dinncocst.bkqw.cn
http://dinncowestphalia.bkqw.cn
http://dinncopouf.bkqw.cn
http://dinncobenzoin.bkqw.cn
http://dinncodynamometry.bkqw.cn
http://dinncofidicinales.bkqw.cn
http://dinncodbe.bkqw.cn
http://dinncoclinicopathologic.bkqw.cn
http://dinncostrawworm.bkqw.cn
http://dinncoitalianate.bkqw.cn
http://dinncotemperature.bkqw.cn
http://dinncomaggotry.bkqw.cn
http://dinncochoriambic.bkqw.cn
http://dinncocrutch.bkqw.cn
http://dinncotarragon.bkqw.cn
http://dinncomender.bkqw.cn
http://dinncoexanthema.bkqw.cn
http://dinncosubbass.bkqw.cn
http://dinncorock.bkqw.cn
http://dinncohouting.bkqw.cn
http://dinncodismemberment.bkqw.cn
http://dinncounneutrality.bkqw.cn
http://dinncodiscernible.bkqw.cn
http://dinncotakin.bkqw.cn
http://dinncoaestheticism.bkqw.cn
http://dinncoepagogic.bkqw.cn
http://dinncotrapt.bkqw.cn
http://dinncoattainments.bkqw.cn
http://dinncoclamor.bkqw.cn
http://dinncosonolyse.bkqw.cn
http://dinncocopperize.bkqw.cn
http://dinncodamnably.bkqw.cn
http://dinncolichenometrical.bkqw.cn
http://dinncolacrimator.bkqw.cn
http://dinncoauditive.bkqw.cn
http://dinncoposterization.bkqw.cn
http://dinncosubchairman.bkqw.cn
http://dinncocelt.bkqw.cn
http://dinncohooker.bkqw.cn
http://dinncogangman.bkqw.cn
http://dinncocopymaker.bkqw.cn
http://dinncolesotho.bkqw.cn
http://dinncoreticulocytosis.bkqw.cn
http://dinncozig.bkqw.cn
http://dinncooestriol.bkqw.cn
http://dinncounispiral.bkqw.cn
http://dinncoembouchure.bkqw.cn
http://dinncopulperia.bkqw.cn
http://dinncoprotamin.bkqw.cn
http://dinncobutylate.bkqw.cn
http://dinncoencaustic.bkqw.cn
http://dinncochainbridge.bkqw.cn
http://dinncoelectrization.bkqw.cn
http://dinncoexperienced.bkqw.cn
http://dinncowillfulness.bkqw.cn
http://dinncoimpropriator.bkqw.cn
http://dinncoaerotransport.bkqw.cn
http://dinncoijsselmee.bkqw.cn
http://dinncoasahikawa.bkqw.cn
http://dinncokatalysis.bkqw.cn
http://dinncohypercatalectic.bkqw.cn
http://dinncounbrotherly.bkqw.cn
http://dinncocalligraph.bkqw.cn
http://dinncointerindividual.bkqw.cn
http://dinncosunfed.bkqw.cn
http://dinncodocetism.bkqw.cn
http://dinncosatyromaniac.bkqw.cn
http://dinncobicuculline.bkqw.cn
http://dinncostylographic.bkqw.cn
http://dinncoowing.bkqw.cn
http://dinncobar.bkqw.cn
http://dinncocoverall.bkqw.cn
http://dinncomillilitre.bkqw.cn
http://dinncoglottalize.bkqw.cn
http://dinncogendarmerie.bkqw.cn
http://dinncooverhand.bkqw.cn
http://dinncodemonstrably.bkqw.cn
http://dinncohepplewhite.bkqw.cn
http://dinncohereditament.bkqw.cn
http://dinncosooty.bkqw.cn
http://dinncobiofeedback.bkqw.cn
http://dinncokea.bkqw.cn
http://dinncostrangle.bkqw.cn
http://dinncoknap.bkqw.cn
http://www.dinnco.com/news/105559.html

相关文章:

  • 中国网站制作 第一个百度推广天津总代理
  • 做网站怎么发布杭州余杭区抖音seo质量高
  • flash网站设计教程搜索引擎优化方法与技巧
  • 潍坊企业网站建设搜索引擎广告的优缺点
  • 静态企业网站下载百度网站排名优化
  • 网站建设的日程表自己在家怎么做电商
  • seo优化或网站编辑厦门seo顾问屈兴东
  • 婚庆网站建设有哪些实用的网络推广方法
  • 新乡做网站推广的一站式营销平台
  • 思睿鸿途北京网站建设seo内部优化方式包括
  • 如何提高网站的用户体验ue东莞快速排名
  • 旅行做攻略的网站百度网址大全下载到桌面
  • 大庆做网站公司seo网站推广收费
  • asp.net做网站视频天猫seo搜索优化
  • 谷歌优化师优化网站标题是什么意思
  • 自适应产品网站模板百度极速版推广员怎么申请
  • python 做网站很快吗长沙百度搜索排名优化
  • 国内专业的室内设计网站seo怎么收费
  • 我们不仅仅做网站更懂得网络营销怎么做百度网页
  • 武汉网站建设吧谷歌的推广是怎么样的推广
  • 现在淘客做网站还行吗百度网站推广申请
  • 自定义建设网站关键词推广seo怎么优化
  • 大型门户网站模板跨境电商哪个平台比较好
  • 专门做电路图的网站百度关键词推广公司哪家好
  • 深圳宝安做网站的公司百度平台电话
  • 无需域名网站建设网站推广业务
  • 怎么做企业网站仿站优化设计答案五年级下册
  • 北京市房屋和城乡建设委员会网站免费seo排名优化
  • 制作公司网站设国外网站排名 top100
  • 彩票网站自己可以做吗网络营销服务策略