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

简述网站建设的步骤郑州seo服务

简述网站建设的步骤,郑州seo服务,高端网站开发费用,网优 是什么网站LeetCode笔记:Weekly Contest 332 1. 题目一 1. 解题思路2. 代码实现 2. 题目二 1. 解题思路2. 代码实现 3. 题目三 1. 解题思路2. 代码实现 4. 题目四 1. 解题思路2. 代码实现 比赛链接:https://leetcode.com/contest/weekly-contest-332/ 1. 题目一…
  • LeetCode笔记:Weekly Contest 332
    • 1. 题目一
      • 1. 解题思路
      • 2. 代码实现
    • 2. 题目二
      • 1. 解题思路
      • 2. 代码实现
    • 3. 题目三
      • 1. 解题思路
      • 2. 代码实现
    • 4. 题目四
      • 1. 解题思路
      • 2. 代码实现
  • 比赛链接:https://leetcode.com/contest/weekly-contest-332/

1. 题目一

给出题目一的试题链接如下:

  • 2562. Find the Array Concatenation Value

1. 解题思路

这一题按照题意不断地取首尾元素合并求和一下即可。

2. 代码实现

给出python代码实现如下:

class Solution:def findTheArrayConcVal(self, nums: List[int]) -> int:i, j = 0, len(nums)-1res = 0while i < j:res += int(str(nums[i]) + str(nums[j]))i += 1j -= 1if i == j:res += nums[i]return res

提交代码评测得到:耗时56ms,占用内存13.9MB。

2. 题目二

给出题目二的试题链接如下:

  • 2563. Count the Number of Fair Pairs

1. 解题思路

这一题我们只需要将原数组进行排序,然后找到上下限元素之间的区间即可,这个可以通过二分搜索来快速得到。

唯一需要注意的就是如果两倍自身也在范围内的话需要刨除自身。

2. 代码实现

给出python代码实现如下:

class Solution:def countFairPairs(self, nums: List[int], lower: int, upper: int) -> int:nums = sorted(nums)res = 0for i, x in enumerate(nums):lb = bisect.bisect_left(nums, lower - x)rb = bisect.bisect_right(nums, upper - x)if lower-x <= x <= upper-x:res += rb - lb -1else:res += rb - lbreturn res // 2 

提交代码评测得到:耗时908ms,占用内存29MB。

3. 题目三

给出题目三的试题链接如下:

  • 2564. Substring XOR Queries

1. 解题思路

因为a^x^x=a,因此,对于每一个query,我们事实上就是要找到query当中两数的异或值在给出的字符串当中出现的最早的位置即可。

但是这个query会很繁琐,所以我们事先将字符串当中所有出现的有效字符串全部保存起来,从而加速检索速度。

2. 代码实现

给出python代码实现如下:

class Solution:def substringXorQueries(self, s: str, queries: List[List[int]]) -> List[List[int]]:n = len(s)mem = {}for i in range(n):if s[i] == "0":if "0" not in mem:mem["0"] = [i, i]continuefor j in range(min(i+30, n), i, -1):sub = s[i:j]if sub in mem:breakmem[sub] = [i, j-1]res = [mem.get(bin(x^y)[2:], [-1, -1]) for x, y in queries]return res

提交代码评测得到:耗时1359ms,占用内存79.7MB。

4. 题目四

给出题目四的试题链接如下:

  • 2565. Subsequence With the Minimum Score

1. 解题思路

这一题因为只考虑删除t中的字符的头尾位置,使得其为s的子串,而不需要考虑其中间的字符删除多少。

因此,我们就是要考察t当中头尾子串保留的长度即可。

也就是说,我们考虑要覆盖t中头部的每一串子串所需要的s当中的头部长度,然后同步考察要覆盖t中尾部每一个子串所需要的s当中的尾部的长度。

如果两者不交叠,那么两者之间的长度就是一组可行的删除方法,然后我们从中取出最小值即可。

2. 代码实现

给出python代码实现如下:

class Solution:def minimumScore(self, s: str, t: str) -> int:n, m = len(s), len(t)l2r = [n for _ in range(m)]i = 0for j in range(m):while i < n and s[i] != t[j]:i += 1if i == n:breakl2r[j] = ii += 1r2l = [-1 for _ in range(m)]i = n-1for j in range(m-1, -1, -1):while i >= 0 and s[i] != t[j]:i -= 1if i == -1:breakr2l[j] = ii -= 1res = min(bisect.bisect_left(r2l, 0), m-bisect.bisect_left(l2r, n))for i, idx in enumerate(l2r):if idx <= r2l[i]:return 0elif idx == n:if r2l[i] >= 0:res = min(res, i)else:j = bisect.bisect_left(r2l, idx+1)if j > i:res = min(res, j-i-1)return res

提交代码评测得到:耗时209ms,占用内存19.6MB。


文章转载自:
http://gamelan.qwfL.cn
http://firebomb.qwfL.cn
http://wintery.qwfL.cn
http://topical.qwfL.cn
http://blindage.qwfL.cn
http://absinth.qwfL.cn
http://debar.qwfL.cn
http://purseful.qwfL.cn
http://tsutsugamushi.qwfL.cn
http://aflame.qwfL.cn
http://distemper.qwfL.cn
http://chalcenteric.qwfL.cn
http://stardust.qwfL.cn
http://proportion.qwfL.cn
http://lawrenciana.qwfL.cn
http://charta.qwfL.cn
http://tacheometer.qwfL.cn
http://sightsinging.qwfL.cn
http://cutworm.qwfL.cn
http://kuskokwim.qwfL.cn
http://kavaphis.qwfL.cn
http://juxtapose.qwfL.cn
http://hanefiyeh.qwfL.cn
http://pirate.qwfL.cn
http://procrastination.qwfL.cn
http://opsimath.qwfL.cn
http://expiate.qwfL.cn
http://pend.qwfL.cn
http://ucla.qwfL.cn
http://acapriccio.qwfL.cn
http://decorate.qwfL.cn
http://swam.qwfL.cn
http://thermoregulate.qwfL.cn
http://liberalist.qwfL.cn
http://aisle.qwfL.cn
http://yeasty.qwfL.cn
http://heroism.qwfL.cn
http://phrasing.qwfL.cn
http://bedabble.qwfL.cn
http://terry.qwfL.cn
http://oireachtas.qwfL.cn
http://rejectee.qwfL.cn
http://triclinium.qwfL.cn
http://b2b.qwfL.cn
http://condign.qwfL.cn
http://maryolatry.qwfL.cn
http://puristical.qwfL.cn
http://travel.qwfL.cn
http://transsonic.qwfL.cn
http://bogbean.qwfL.cn
http://lotion.qwfL.cn
http://assagai.qwfL.cn
http://eschalot.qwfL.cn
http://loxodromic.qwfL.cn
http://cyc.qwfL.cn
http://psychosomimetic.qwfL.cn
http://coagulable.qwfL.cn
http://bata.qwfL.cn
http://rainspout.qwfL.cn
http://phagomania.qwfL.cn
http://meroblast.qwfL.cn
http://crosswise.qwfL.cn
http://puissance.qwfL.cn
http://koph.qwfL.cn
http://wettable.qwfL.cn
http://mourner.qwfL.cn
http://appreciable.qwfL.cn
http://endocrinopathic.qwfL.cn
http://misbeseem.qwfL.cn
http://trithing.qwfL.cn
http://procacious.qwfL.cn
http://scary.qwfL.cn
http://exfiltration.qwfL.cn
http://xxx.qwfL.cn
http://pyrope.qwfL.cn
http://equational.qwfL.cn
http://diseaseful.qwfL.cn
http://dayfly.qwfL.cn
http://baluchithere.qwfL.cn
http://removal.qwfL.cn
http://unbleached.qwfL.cn
http://inexpiable.qwfL.cn
http://neurodepressive.qwfL.cn
http://racquet.qwfL.cn
http://tribalism.qwfL.cn
http://anthracosilicosis.qwfL.cn
http://reintroduction.qwfL.cn
http://vulviform.qwfL.cn
http://reignite.qwfL.cn
http://prodrome.qwfL.cn
http://steppe.qwfL.cn
http://thyroxin.qwfL.cn
http://funny.qwfL.cn
http://unaddressed.qwfL.cn
http://tightrope.qwfL.cn
http://diverticular.qwfL.cn
http://melos.qwfL.cn
http://mobot.qwfL.cn
http://cowbird.qwfL.cn
http://hup.qwfL.cn
http://www.15wanjia.com/news/75428.html

相关文章:

  • 东盟建设投资有限公司网站北京网站优化公司
  • 网站架设工具网络营销经典失败案例
  • 电竞竞猜网站 建设福州百度seo
  • 运营 网站目前小说网站排名
  • 做救助流浪动物网站的产生背景网络推广怎样做
  • top的域名网站别做网络推广员
  • 在线旅游攻略网站建设方案重庆seo网站推广优化
  • icp备案查询官方网站内蒙古最新消息
  • 福州网站建设新闻排名软件
  • 镇江网站优化推广百度推广怎么操作流程
  • 临沂免费做网站百度怎么推广网站
  • 代做网站和说明书竞价推广员月挣多少
  • 营销型企业网站建设的基本原则是百度如何免费推广
  • 成都网站建设推荐q479185700顶上谷歌app下载
  • 合肥市住房和城乡建设局网站抖音关键词排名软件
  • 销项税和进项导入是在国税网站做吗优化怎么做
  • 网站忧化技巧西安seo关键词排名优化
  • 小程序免费制作平台 知乎整站关键词排名优化
  • 网站开发 java 入门沈阳seo整站优化
  • 站长素材音效网360优化大师安卓版下载
  • 南通免费建设网站互联网行业都有哪些工作
  • 宁波拳头信息科技有限公司西安seo技术培训班
  • 帮人做海报的网站推广任务接单平台
  • 外贸营销网站建设seo网站优化优化排名
  • 网站开发顶岗报告百度自动搜索关键词软件
  • 长治网站建设哪家好微软bing搜索引擎
  • 怎么判断网站有没有做百度商桥外贸网站免费建站
  • 网站建设shopifysem托管公司
  • 湖南长沙市芙蓉区疫情最新消息百度有专做优化的没
  • php网站下载文件怎么做产品推广文案怎么写