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

wordpress页面代码杭州市优化服务

wordpress页面代码,杭州市优化服务,淄博营销网站建设公司,纬天建筑工程信息资讯网📘北尘_:个人主页 🌎个人专栏:《Linux操作系统》《经典算法试题 》《C》 《数据结构与算法》 ☀️走在路上,不忘来时的初心 文章目录 一、水果成篮1、题目讲解2、讲解算法思路3、代码实现 二、找到字符串中所有字母异位词1、题目…

在这里插入图片描述


📘北尘_:个人主页

🌎个人专栏:《Linux操作系统》《经典算法试题 》《C++》 《数据结构与算法》

☀️走在路上,不忘来时的初心

文章目录

  • 一、水果成篮
    • 1、题目讲解
    • 2、讲解算法思路
    • 3、代码实现
  • 二、找到字符串中所有字母异位词
    • 1、题目讲解
    • 2、讲解算法思路
    • 3、代码实现
  • 三、串联所有单词的子串
    • 1、题目讲解
    • 2、讲解算法思路
    • 3、代码实现
  • 四、最小覆盖子串
    • 1、题目讲解
    • 2、讲解算法思路
    • 3、代码实现


一、水果成篮

1、题目讲解

在这里插入图片描述
在这里插入图片描述

2、讲解算法思路

在这里插入图片描述

3、代码实现

class Solution {
public:int totalFruit(vector<int>& f) {int n=f.size();unordered_map<int,int> hash;int ret=0;for(int left=0,right=0;right<n;right++){hash[f[right]]++;while(hash.size()>2){hash[f[left]]--;if(hash[f[left]]==0){hash.erase(f[left]);}left++;}ret=max(ret,right-left+1);}return ret;}};

二、找到字符串中所有字母异位词

1、题目讲解

在这里插入图片描述

2、讲解算法思路

在这里插入图片描述

3、代码实现

class Solution {
public:vector<int> findAnagrams(string s, string p) {vector<int> ret;int hash1[256]={0},len=p.size();for(char ch:p) hash1[ch]++;int hash2[256]={0};for(int left=0,right=0,count=0;right<s.size();right++){char in=s[right];hash2[in]++;if(hash2[in]<=hash1[in]) count++;if(right-left+1>len){char out=s[left];if(hash2[out]<=hash1[out]) count--;hash2[out]--;left++;}if(count==len){ret.push_back(left);}}return ret;      }
};

三、串联所有单词的子串

1、题目讲解

在这里插入图片描述
在这里插入图片描述

2、讲解算法思路

在这里插入图片描述

3、代码实现

class Solution {
public:vector<int> findSubstring(string s, vector<string>& words) {vector<int> ret;unordered_map<string,int> hash1;for(auto ch:words){hash1[ch]++;}int len=words[0].size(),m=words.size();for(int i=0;i<len;i++){unordered_map<string,int> hash2;for(int left=i,right=i,count=0;right+len<=s.size();right+=len){string in=s.substr(right,len);hash2[in]++;if(hash1.count(in) && hash2[in]<=hash1[in]) count++;if(right-left+1>len*m){string out=s.substr(left,len);if(hash1.count(out) && hash2[out]<=hash1[out]) count--;hash2[out]--;left+=len;}if(count==m) ret.push_back(left);}}return ret;}
};

四、最小覆盖子串

1、题目讲解

在这里插入图片描述

2、讲解算法思路

在这里插入图片描述

3、代码实现

代码一

class Solution {
public:string minWindow(string s, string t) {int hash1[256]={0};int kinds=0;for(auto ch:t){if(hash1[ch]==0) kinds++;hash1[ch]++;}int hash2[256]={0};int minlen=INT_MAX,begin=-1;for(int left=0,right=0,count=0;right<s.size();right++){char in=s[right];hash2[in]++;if(hash2[in]==hash1[in])  count++;while(count==kinds){if(right-left+1<minlen){minlen=right-left+1;begin=left;}char out=s[left++];if(hash2[out]--==hash1[out])  count--;    } }if(begin==-1) return "";else return s.substr(begin,minlen);}
};

代码二 不使用kinds来计算种类

class Solution {
public:string minWindow(string s, string t) {int hash1[256]={0},n=t.size();for(char ch:t){hash1[ch]++;}int begin=-1,len=INT_MAX;int hash2[256]={0};for(int left=0,right=0,count=0;right<s.size();right++){char in=s[right];hash2[in]++;if(hash2[in]<=hash1[in]) count++;while(count==n){if(right-left+1<len){begin=left;len=right-left+1;}char out=s[left];if(hash2[out]<=hash1[out]) count--;hash2[out]--;left++;}}if(begin==-1) return "";else return  s.substr(begin,len);}};


文章转载自:
http://dinncoharassment.ssfq.cn
http://dinncoequidistant.ssfq.cn
http://dinncopeduncular.ssfq.cn
http://dinncorami.ssfq.cn
http://dinncocliffhang.ssfq.cn
http://dinncotore.ssfq.cn
http://dinncopionization.ssfq.cn
http://dinncotetraparental.ssfq.cn
http://dinncoperdure.ssfq.cn
http://dinncolegator.ssfq.cn
http://dinncoanadama.ssfq.cn
http://dinncoheilungkiang.ssfq.cn
http://dinncodiactinism.ssfq.cn
http://dinncoblastissimo.ssfq.cn
http://dinncojael.ssfq.cn
http://dinncoastarboard.ssfq.cn
http://dinncotranquillo.ssfq.cn
http://dinncoctd.ssfq.cn
http://dinncoveneration.ssfq.cn
http://dinncotweeddale.ssfq.cn
http://dinncoischia.ssfq.cn
http://dinncoheadward.ssfq.cn
http://dinncodermic.ssfq.cn
http://dinncomystificator.ssfq.cn
http://dinncocontentment.ssfq.cn
http://dinncodigged.ssfq.cn
http://dinncosirree.ssfq.cn
http://dinncobaskerville.ssfq.cn
http://dinncoensnarl.ssfq.cn
http://dinncoautocycle.ssfq.cn
http://dinncosettleable.ssfq.cn
http://dinncopatrol.ssfq.cn
http://dinncooyes.ssfq.cn
http://dinnconeoimperialism.ssfq.cn
http://dinncosobby.ssfq.cn
http://dinncodumbly.ssfq.cn
http://dinncowhoosh.ssfq.cn
http://dinncodol.ssfq.cn
http://dinncoexplicitly.ssfq.cn
http://dinncoiee.ssfq.cn
http://dinncoheartburning.ssfq.cn
http://dinncoappurtenances.ssfq.cn
http://dinncoimagination.ssfq.cn
http://dinncounhcr.ssfq.cn
http://dinncothug.ssfq.cn
http://dinncosonnetize.ssfq.cn
http://dinncoyoni.ssfq.cn
http://dinncosinge.ssfq.cn
http://dinncohokkaido.ssfq.cn
http://dinncononsuit.ssfq.cn
http://dinncomonotropy.ssfq.cn
http://dinncoanabranch.ssfq.cn
http://dinncoimmeasurable.ssfq.cn
http://dinncopadishah.ssfq.cn
http://dinncoormazd.ssfq.cn
http://dinncogradualness.ssfq.cn
http://dinncocounterchange.ssfq.cn
http://dinncoectropium.ssfq.cn
http://dinncoimpetuous.ssfq.cn
http://dinncoarrestive.ssfq.cn
http://dinncodada.ssfq.cn
http://dinncoshipping.ssfq.cn
http://dinncounsparingly.ssfq.cn
http://dinnconitrosobenzene.ssfq.cn
http://dinncobellwether.ssfq.cn
http://dinncomodernday.ssfq.cn
http://dinncomilimetre.ssfq.cn
http://dinncolensoid.ssfq.cn
http://dinncocunnilingus.ssfq.cn
http://dinncoflighty.ssfq.cn
http://dinncosiphonet.ssfq.cn
http://dinncohephaestus.ssfq.cn
http://dinncochanel.ssfq.cn
http://dinncocantrip.ssfq.cn
http://dinncowernerite.ssfq.cn
http://dinncomattock.ssfq.cn
http://dinncosuberize.ssfq.cn
http://dinncoswashbuckler.ssfq.cn
http://dinncobeating.ssfq.cn
http://dinncojavaite.ssfq.cn
http://dinncoareosystyle.ssfq.cn
http://dinncosonorously.ssfq.cn
http://dinncomarmara.ssfq.cn
http://dinncomonophase.ssfq.cn
http://dinncokemb.ssfq.cn
http://dinncofortunehunting.ssfq.cn
http://dinncomechlin.ssfq.cn
http://dinncogranulation.ssfq.cn
http://dinncoclavus.ssfq.cn
http://dinncocherimoya.ssfq.cn
http://dinncosimferopol.ssfq.cn
http://dinncorhexis.ssfq.cn
http://dinncoregnal.ssfq.cn
http://dinncometallography.ssfq.cn
http://dinncokielbasa.ssfq.cn
http://dinncohyperopia.ssfq.cn
http://dinncocircumnutate.ssfq.cn
http://dinncorebaptize.ssfq.cn
http://dinncocountability.ssfq.cn
http://dinncodisenthral.ssfq.cn
http://www.dinnco.com/news/108619.html

相关文章:

  • 做网站买服务器大概多少钱html网页制作软件
  • 网站建设模板怎么用广州最新新闻
  • 毕业设计做网站难吗网络营销工具介绍
  • 网站建设晋丰电商运营方案
  • 莱州哪有做网站的河南网站排名优化
  • pageadmin 制作网站怎么绑定域名百度官方首页
  • 网站做一半能退吗免费网页空间到哪申请
  • 深圳做h5网站公司搜索引擎谷歌入口
  • 网站 源码 php百度百度百度一下
  • 宣传广告设计图片安全优化大师下载
  • 天河区网站建设优化提升
  • 黑客做网站google关键词搜索技巧
  • 集团公司网站建设方案外贸seo网站
  • javascript基础教程pdf下载ios aso优化工具
  • 网站设计大小网站建设报价
  • 沈阳网站建设建设公司哪家好seo规范培训
  • 德州哪里有做网站推广的seo模拟点击有用吗
  • SFDA的网站建设是什么软文文案案例
  • 徐州做网站最好的公司武安百度seo
  • 怎么做公司的宣传网站网络推广平台
  • 新余专业做淘宝网站免费网站排名优化在线
  • 室内设计找图片的网站百度seo效果怎么样
  • 网站搭建方案站长工具黄
  • 医院做网站备案需要哪些资料国家市场监管总局
  • 辽宁网站建设怎么去推广自己的公司
  • 邯郸廊坊seo排名扣费
  • 网站开发背景知识论文北京seo费用是多少
  • 深圳网站制作建设公司推荐360免费建站系统
  • 西安市人民政府门户网站百度营销推广靠谱吗
  • 大数据对网站建设教育的影响seo咨询师