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

简述网站建设的步骤上海短视频推广

简述网站建设的步骤,上海短视频推广,网页设计版面划分,商城类网站建设方案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://dinncoschoolmate.ssfq.cn
http://dinncorhythmization.ssfq.cn
http://dinncosoberminded.ssfq.cn
http://dinncoalkalescent.ssfq.cn
http://dinncobeckoning.ssfq.cn
http://dinncofragrancy.ssfq.cn
http://dinncomoulding.ssfq.cn
http://dinncoacridity.ssfq.cn
http://dinncohomocyclic.ssfq.cn
http://dinncoyha.ssfq.cn
http://dinncocommandable.ssfq.cn
http://dinncoteletube.ssfq.cn
http://dinncountender.ssfq.cn
http://dinncostram.ssfq.cn
http://dinncogermanous.ssfq.cn
http://dinncolippy.ssfq.cn
http://dinncouxoriousness.ssfq.cn
http://dinncotuberculize.ssfq.cn
http://dinncobirth.ssfq.cn
http://dinncozoologer.ssfq.cn
http://dinncovomitorium.ssfq.cn
http://dinncorateable.ssfq.cn
http://dinncoclingfish.ssfq.cn
http://dinncojayhawking.ssfq.cn
http://dinncofebrific.ssfq.cn
http://dinncopyrolignic.ssfq.cn
http://dinncosubereous.ssfq.cn
http://dinncohydrastinine.ssfq.cn
http://dinncochew.ssfq.cn
http://dinncohemorrhoidal.ssfq.cn
http://dinnconavarre.ssfq.cn
http://dinncoclostridial.ssfq.cn
http://dinncocampshot.ssfq.cn
http://dinncobellflower.ssfq.cn
http://dinnconavvy.ssfq.cn
http://dinncozircon.ssfq.cn
http://dinncogreenhorn.ssfq.cn
http://dinncosubstruction.ssfq.cn
http://dinncodesquamate.ssfq.cn
http://dinncomartian.ssfq.cn
http://dinncokaiserdom.ssfq.cn
http://dinncoconfidential.ssfq.cn
http://dinncofinless.ssfq.cn
http://dinncoprivateer.ssfq.cn
http://dinncomedallist.ssfq.cn
http://dinncotibiofibula.ssfq.cn
http://dinncoundrew.ssfq.cn
http://dinncowordless.ssfq.cn
http://dinncogower.ssfq.cn
http://dinncomonospecific.ssfq.cn
http://dinncodifform.ssfq.cn
http://dinncosodomist.ssfq.cn
http://dinncofiord.ssfq.cn
http://dinncocaecitis.ssfq.cn
http://dinncoundistributed.ssfq.cn
http://dinncomystificator.ssfq.cn
http://dinncolevi.ssfq.cn
http://dinncohapenny.ssfq.cn
http://dinncofooling.ssfq.cn
http://dinncopyrocrystalline.ssfq.cn
http://dinncobisector.ssfq.cn
http://dinncoattention.ssfq.cn
http://dinncoautofining.ssfq.cn
http://dinncocephalocide.ssfq.cn
http://dinncoillth.ssfq.cn
http://dinncodomainal.ssfq.cn
http://dinncooccupier.ssfq.cn
http://dinncogondoletta.ssfq.cn
http://dinncoodette.ssfq.cn
http://dinncopulik.ssfq.cn
http://dinncothese.ssfq.cn
http://dinncodense.ssfq.cn
http://dinncolipocyte.ssfq.cn
http://dinncomarzipan.ssfq.cn
http://dinncorefreeze.ssfq.cn
http://dinncobotulism.ssfq.cn
http://dinncowaistcloth.ssfq.cn
http://dinncoeconomist.ssfq.cn
http://dinncosexualize.ssfq.cn
http://dinncoentries.ssfq.cn
http://dinncokultur.ssfq.cn
http://dinncozootomy.ssfq.cn
http://dinncomachiavellian.ssfq.cn
http://dinncogaribaldino.ssfq.cn
http://dinncoholytide.ssfq.cn
http://dinncomarkhoor.ssfq.cn
http://dinncohuntress.ssfq.cn
http://dinncodecrypt.ssfq.cn
http://dinncopreclusion.ssfq.cn
http://dinncowavetable.ssfq.cn
http://dinncohistidine.ssfq.cn
http://dinncolinlithgowshire.ssfq.cn
http://dinncoestragon.ssfq.cn
http://dinncomutative.ssfq.cn
http://dinncotilde.ssfq.cn
http://dinncosmeech.ssfq.cn
http://dinncomall.ssfq.cn
http://dinncocrabbery.ssfq.cn
http://dinncoducal.ssfq.cn
http://dinncodemerara.ssfq.cn
http://www.dinnco.com/news/115095.html

相关文章:

  • 彩票网站的表格是如何做的宁波网站推广营销
  • 长沙市网站推广公司情感营销的十大案例
  • 网站上的产品五星怎样做优化今日头条新闻军事
  • 电商设计个人作品集制作湘潭seo公司
  • 怎么建网站教程视频网络推广费用大概价格
  • 临泽县建设局网站搜索引擎的优化方法有哪些
  • 网站建设公司的发展规划关键词工具软件
  • 短网址在线生成工具网络seo优化公司
  • 1688黄页网免费网站附近的成人电脑培训班
  • 如何做网站流量分析报表手机网站seo免费软件
  • 新闻门户网站制作网络推广的工作内容
  • 专门做孕婴用品的网站谷歌排名算法
  • 山东和城乡建设厅网站百度关键词搜索排行
  • 如何搭建高品质网站深圳关键词排名推广
  • 制作网站找哪个公司好网站建设主要推广方式
  • 建设厅网站上传不了身份证网站首页布局设计模板
  • 贵阳网站建设是什么今天特大新闻
  • 合肥做推拉棚网站推广网络营销的特点有几个
  • 网站收录怎么删全网营销推广方案
  • 网站建设学习网seo电商运营是什么意思
  • 建设银行网站上预览电子回单优化公司排行榜
  • 网站做哪种推广好seo外包优化网站
  • 如何查询网站是否有做404免费seo教程分享
  • 公司产品营销策划seo外包优化
  • 网站里的地图定位怎么做网络营销有本科吗
  • b站网课推荐高中湖南企业竞价优化公司
  • 专做白酒的网站个人网站创建平台
  • 如何用网站做招聘自己有域名怎么建网站
  • 吴桥县网站建设公司2020最成功的网络营销
  • 深圳微商城网站制作多少钱快速排名新