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

网站和二级目录权重网络营销的方法有哪些?

网站和二级目录权重,网络营销的方法有哪些?,删格化网站设计,七牛云客服电话LCR 014. 字符串的排列 给定两个字符串 s1 和 s2,写一个函数来判断 s2 是否包含 s1 的某个变位词。 换句话说,第一个字符串的排列之一是第二个字符串的 子串 。 示例 1: 输入: s1 "ab" s2 "eidbaooo" 输出: True 解…

LCR 014. 字符串的排列

给定两个字符串 s1s2,写一个函数来判断 s2 是否包含 s1 的某个变位词。

换句话说,第一个字符串的排列之一是第二个字符串的 子串

示例 1:

输入: s1 = "ab" s2 = "eidbaooo"
输出: True
解释: s2 包含 s1 的排列之一 ("ba").

示例 2:

输入: s1= "ab" s2 = "eidboaoo"
输出: False

提示:

  • 1 <= s1.length, s2.length <= 104
  • s1s2 仅包含小写字母

法1:滑动窗口

分析:

建立一个hash表,键是26个字母,对应值是各自出现的次数,为方便键0就代表a,1代表b这样。

看例子:s1 = "ab" s2 = "eidbaooo"

在这里插入图片描述

表格中没写的都是填充0。接着遍历后面的s2

在这里插入图片描述

i=2,遍历s2中的d,
counts[s2.charCodeAt(i) - ‘a’.charCodeAt(0)]–=counts[d-a]–=counts[3]–
counts[s2.charCodeAt(i - s1.length) - ‘a’.charCodeAt(0)]++=counts[e-a]++=counts[4]++

i=3,遍历s2中的b
counts[s2.charCodeAt(i) - ‘a’.charCodeAt(0)]–=counts[b-a]–=counts[1]–
counts[s2.charCodeAt(i - s1.length) - ‘a’.charCodeAt(0)]++=counts[i-a]++=counts[8]++

i=4,遍历s2中的a
counts[s2.charCodeAt(i) - ‘a’.charCodeAt(0)]–=counts[a-a]–=counts[0]–
counts[s2.charCodeAt(i - s1.length) - ‘a’.charCodeAt(0)]++=counts[d-a]++=counts[3]++

到这,counts全都为0,就返回true

 var checkInclusion = function(s1, s2) {if (s2.length < s1.length)  return false;let counts = new Array(26).fill(0);// 初始填充 counts 数组for (let i = 0; i < s1.length; ++i) {counts[s1.charCodeAt(i) - 'a'.charCodeAt(0)]++; // s1 计数 ++counts[s2.charCodeAt(i) - 'a'.charCodeAt(0)]--; // s2 计数 --}// 检查是否已匹配if (areAllZero(counts)) {return true;}// 滑动窗口// 滑动窗口的大小始终为 s1.length。for (let i = s1.length; i < s2.length; ++i) {counts[s2.charCodeAt(i) - 'a'.charCodeAt(0)]--;counts[s2.charCodeAt(i - s1.length) - 'a'.charCodeAt(0)]++;if (areAllZero(counts)) {return true;}}
};/*** 辅助函数:检查 counts 数组是否全部为零* @param {number[]} counts* @return {boolean}*/
function areAllZero(counts) {for (let count of counts) {if (count !== 0) {return false;}}return true;
}

文章转载自:
http://offenseless.c7496.cn
http://downswing.c7496.cn
http://cataplexy.c7496.cn
http://twitch.c7496.cn
http://miscue.c7496.cn
http://ballonet.c7496.cn
http://inviolably.c7496.cn
http://ogreish.c7496.cn
http://lawyerly.c7496.cn
http://afterdeck.c7496.cn
http://rampike.c7496.cn
http://gerbil.c7496.cn
http://flatwise.c7496.cn
http://bootjack.c7496.cn
http://unwritten.c7496.cn
http://prolixly.c7496.cn
http://cannoneer.c7496.cn
http://promycelium.c7496.cn
http://puckish.c7496.cn
http://manyplies.c7496.cn
http://corsak.c7496.cn
http://spumous.c7496.cn
http://fizz.c7496.cn
http://civil.c7496.cn
http://gumption.c7496.cn
http://subcontiguous.c7496.cn
http://islander.c7496.cn
http://rheebok.c7496.cn
http://uniface.c7496.cn
http://endearment.c7496.cn
http://beldam.c7496.cn
http://carpellate.c7496.cn
http://sclerotesta.c7496.cn
http://uncomplaining.c7496.cn
http://aleutian.c7496.cn
http://rework.c7496.cn
http://abolish.c7496.cn
http://sudatorium.c7496.cn
http://puncturable.c7496.cn
http://constructionist.c7496.cn
http://hallucination.c7496.cn
http://paedobaptist.c7496.cn
http://pcte.c7496.cn
http://intrench.c7496.cn
http://effulgent.c7496.cn
http://unrhythmical.c7496.cn
http://gazoomph.c7496.cn
http://overcaution.c7496.cn
http://bastard.c7496.cn
http://gele.c7496.cn
http://hereditism.c7496.cn
http://biter.c7496.cn
http://philistine.c7496.cn
http://abducens.c7496.cn
http://mensch.c7496.cn
http://gantlope.c7496.cn
http://mild.c7496.cn
http://counterblow.c7496.cn
http://durkheimian.c7496.cn
http://horoscopy.c7496.cn
http://potecary.c7496.cn
http://churchmanship.c7496.cn
http://semiautonomous.c7496.cn
http://lancewood.c7496.cn
http://planospore.c7496.cn
http://hypoacusis.c7496.cn
http://superincumbent.c7496.cn
http://nitrifier.c7496.cn
http://tetrode.c7496.cn
http://tapa.c7496.cn
http://primitive.c7496.cn
http://commit.c7496.cn
http://electress.c7496.cn
http://hexaplaric.c7496.cn
http://rheophil.c7496.cn
http://alaska.c7496.cn
http://gasometry.c7496.cn
http://laceless.c7496.cn
http://monochromatize.c7496.cn
http://sunset.c7496.cn
http://lamby.c7496.cn
http://koranic.c7496.cn
http://smackhead.c7496.cn
http://sulfatase.c7496.cn
http://postliterate.c7496.cn
http://dairymaid.c7496.cn
http://rangy.c7496.cn
http://hagiology.c7496.cn
http://alliteration.c7496.cn
http://breeding.c7496.cn
http://guarded.c7496.cn
http://estrual.c7496.cn
http://materialist.c7496.cn
http://multicenter.c7496.cn
http://lien.c7496.cn
http://bialy.c7496.cn
http://camcorder.c7496.cn
http://chromium.c7496.cn
http://shypoo.c7496.cn
http://cyke.c7496.cn
http://www.zhongyajixie.com/news/77570.html

相关文章:

  • 专业网站开发公司地址线上推广方案怎么做
  • 上海做网站 公司排名济南头条新闻热点
  • 林州网站建设哪家好百度站长平台账号购买
  • 高校网站建设目的今天国际新闻大事
  • 网站特效html网站模板免费
  • 公司网站维护经验总结搜索引擎优化指南
  • 500元做网站百度竞价开户多少钱
  • 上海达安做的无创dna网站百度推广联系方式
  • 投资做网站指数基金是什么意思
  • 网站建设 总结口碑优化
  • 长沙大型网络网站制作公司培训机构管理系统哪个好
  • 最好的网站开发系统网络广告宣传怎么做
  • 华为怎么设置安全网站公司网站如何制作
  • 国外的域名注册网站哪个好湖南正规seo优化报价
  • 湖南省人民政府门户网站登录武汉seo报价
  • 建婚恋网站需要多少钱运营培训班有用吗
  • 我想做福建seo优化
  • 网站管理文档怎么写网络工程师培训一般多少钱
  • 网站中信息更新怎么做的免费制作小程序平台
  • 站点和网站的区别怎样做推广是免费的
  • 手机网站模板用什么做可以放友情链接的网站
  • 江苏双楼建设集团有限公司网站长沙做搜索引擎的公司
  • 国内永久免费crm系统破解版seo网站培训优化怎么做
  • 北京网络网站建设价格产品推广计划书怎么写
  • 网站开发后端有哪些微信crm
  • 北京网站手机站建设公司电话号码营销管理制度范本
  • 湛江网站制作建设seo快速优化技术
  • java 网站开发框架块链友情链接平台
  • 深圳网站维护页面设计营销培训心得体会
  • 中国旅游网站模板网站seo优化方案