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

wordpress验证ticket如何做优化排名

wordpress验证ticket,如何做优化排名,电商网站设计教程,网站备案接入商名称记录了初步解题思路 以及本地实现代码;并不一定为最优 也希望大家能一起探讨 一起进步 目录 9/23 2414. 最长的字母序连续子字符串的长度9/24 2207. 字符串中最多数目的子序列9/25 2306. 公司命名9/26 2535. 数组元素和与数字和的绝对差9/27 2516. 每种字符至少取 K…

记录了初步解题思路 以及本地实现代码;并不一定为最优 也希望大家能一起探讨 一起进步


目录

      • 9/23 2414. 最长的字母序连续子字符串的长度
      • 9/24 2207. 字符串中最多数目的子序列
      • 9/25 2306. 公司命名
      • 9/26 2535. 数组元素和与数字和的绝对差
      • 9/27 2516. 每种字符至少取 K 个
      • 9/28 2286. 以组为单位订音乐会的门票
      • 9/29


9/23 2414. 最长的字母序连续子字符串的长度

依次遍历 cur记录当前满足条件的字符串长度
如果当前字符s[i]比前一个字符字母序大1则满足条件 cur+1

def longestContinuousSubstring(s):""":type s: str:rtype: int"""ans = 1cur = 1for i in range(1,len(s)):if ord(s[i])-ord(s[i-1])==1:cur+=1else:cur=1ans=max(ans,cur)return ans

9/24 2207. 字符串中最多数目的子序列

为了使得增加一个字符增加的子序列最多
pattern[0]加在开头 pattern[1]加在结尾
从头遍历 统计pattern[0],[1]出现次数p0.p1
遇到pattern[1] 说明该字符可以与前边的pattern[0]组合成p0个子序列
最后 哪个多那就添加另外一个字符 增加max(p0,p1)个子序列

def maximumSubsequenceCount(text, pattern):""":type text: str:type pattern: str:rtype: int"""p0,p1=0,0ans =0for c in text:if c==pattern[1]:ans += p0p1+=1if c==pattern[0]:p0+=1return ans+max(p0,p1)

9/25 2306. 公司命名

首字母相同的公司必定不满足条件
按首字母将idea分类
m[h]存储以字母h为首字母的剩余字符
遍历所有首字母
h1,h2中有后续字符序列s1,s2
只有不在s1,s2交集中的序列才可以相互组合
(s1-s1&s2)*(s2-s1&s2)

def distinctNames(ideas):""":type ideas: List[str]:rtype: int"""from collections import defaultdictm = defaultdict(set)for s in ideas:m[s[0]].add(s[1:])ans = 0for h1,s1 in m.items():for h2,s2 in m.items():if h1==h2:continuesame = len(s1&s2)ans +=(len(s1)-same)*(len(s2)-same)return ans

9/26 2535. 数组元素和与数字和的绝对差

依次求出元素和 数字和

def differenceOfSum(nums):""":type nums: List[int]:rtype: int"""s0=0s1=0for num in nums:s0+=numwhile num:s1+=num%10num//=10return s0-s1

9/27 2516. 每种字符至少取 K 个

取走左右两侧 中间部分必定是连续的
可以用双指针考虑中间部分区间
中间部分越长 则取走的次数越少

def takeCharacters(s, k):""":type s: str:type k: int:rtype: int"""n=len(s)if n<3*k:return -1cnt={'a':0,'b':0,'c':0}for c in s:cnt[c]+=1if cnt['a']<k or cnt['b']<k or cnt['c']<k:return -1ans = len(s)l = 0for r,c in enumerate(s):cnt[c]-=1while l<r and (cnt['a']<k or cnt['b']<k or cnt['c']<k):cnt[s[l]]+=1l+=1if cnt['a']>=k and cnt['b']>=k and cnt['c']>=k:ans = min(ans,n-(r-l+1))return ans

9/28 2286. 以组为单位订音乐会的门票

线段树minT,sumT记录区间[l,r]排之间 每一排最小已坐位置 和 已坐位置数之和
见题解https://leetcode.cn/problems/booking-concert-tickets-in-groups/solutions/2930664/yi-zu-wei-dan-wei-ding-yin-le-hui-de-men-ay7o

class BookMyShow(object):def __init__(self, n, m):""":type n: int:type m: int"""self.n = nself.m = mself.minT = [0]*(4*n)self.sumT = [0]*(4*n)def modify(self,i,l,r,ind,val):if l==r:self.minT[i]=valself.sumT[i]=valreturnmid=(l+r)//2if ind<=mid:self.modify(i*2,l,mid,ind,val)else:self.modify(i*2+1, mid+1, r, ind, val)self.minT[i]=min(self.minT[i*2],self.minT[i*2+1])self.sumT[i]=self.sumT[i*2]+self.sumT[i*2+1]def queryMin(self,i,l,r,val):if l==r:return l if self.minT[i]<=val else self.nmid = (l+r)//2if self.minT[i*2]<=val:return self.queryMin(i*2,l,mid,val)else:return self.queryMin(i*2+1,mid+1,r,val)def querySum(self,i,l,r,l2,r2):if l2<=l and r<=r2:return self.sumT[i]mid=(l+r)//2s=0if mid>=l2:s+=self.querySum(i*2, l, mid, l2, r2)if mid+1<=r2:s+=self.querySum(i*2+1, mid+1, r, l2, r2)return sdef gather(self, k, maxRow):""":type k: int:type maxRow: int:rtype: List[int]"""i = self.queryMin(1, 0, self.n-1, self.m-k)if i>maxRow:return []used = self.querySum(1, 0, self.n-1, i, i)self.modify(1, 0, self.n-1, i, used+k)return [i,used]def scatter(self, k, maxRow):""":type k: int:type maxRow: int:rtype: bool"""total = self.querySum(1, 0, self.n-1, 0, maxRow)if (maxRow+1)*self.m-total<k:return Falsei = self.queryMin(1, 0, self.n-1, self.m-1)while True:used = self.querySum(1, 0, self.n-1, i, i)if self.m-used>=k:self.modify(1, 0, self.n-1, i, used+k)breakk-=self.m-usedself.modify(1, 0, self.n-1, i, self.m)i+=1return True

9/29



文章转载自:
http://dinncomagnetist.stkw.cn
http://dinncoponiard.stkw.cn
http://dinncopneumatocele.stkw.cn
http://dinncorancheria.stkw.cn
http://dinncoinguinally.stkw.cn
http://dinncopocketful.stkw.cn
http://dinncopathogeny.stkw.cn
http://dinncosquawk.stkw.cn
http://dinncoploidy.stkw.cn
http://dinncolci.stkw.cn
http://dinncoclapham.stkw.cn
http://dinncodisarmament.stkw.cn
http://dinncoana.stkw.cn
http://dinncoextraordinary.stkw.cn
http://dinncobonspiel.stkw.cn
http://dinncoabdominal.stkw.cn
http://dinncovaginated.stkw.cn
http://dinncopostmeridian.stkw.cn
http://dinncoholandric.stkw.cn
http://dinncomasquer.stkw.cn
http://dinncoscar.stkw.cn
http://dinncocalciferous.stkw.cn
http://dinncodrown.stkw.cn
http://dinncoultraclean.stkw.cn
http://dinncofx.stkw.cn
http://dinnconoserag.stkw.cn
http://dinncogormandizer.stkw.cn
http://dinncochromoplasmic.stkw.cn
http://dinnconeedlessly.stkw.cn
http://dinncohcs.stkw.cn
http://dinncoaminopterin.stkw.cn
http://dinncowarehouseman.stkw.cn
http://dinncophotonics.stkw.cn
http://dinncoexaggerate.stkw.cn
http://dinncocrusado.stkw.cn
http://dinncofolly.stkw.cn
http://dinncoeighty.stkw.cn
http://dinncoderivatively.stkw.cn
http://dinncogastroenteric.stkw.cn
http://dinncomultitudinous.stkw.cn
http://dinncosociological.stkw.cn
http://dinncoelectress.stkw.cn
http://dinncofoulness.stkw.cn
http://dinncohaustellate.stkw.cn
http://dinncoastronautics.stkw.cn
http://dinncodoodlebug.stkw.cn
http://dinncodyspnea.stkw.cn
http://dinncoepiphyllous.stkw.cn
http://dinncoferrocene.stkw.cn
http://dinnconucleochronometer.stkw.cn
http://dinncospeedcop.stkw.cn
http://dinncoseptuor.stkw.cn
http://dinncodiamondoid.stkw.cn
http://dinncolobscouser.stkw.cn
http://dinncoquirky.stkw.cn
http://dinncopotomac.stkw.cn
http://dinncodorcas.stkw.cn
http://dinncobrahmanism.stkw.cn
http://dinncoslop.stkw.cn
http://dinncochromiderosis.stkw.cn
http://dinncoliquefiable.stkw.cn
http://dinncogerund.stkw.cn
http://dinncoreapply.stkw.cn
http://dinncoremigrate.stkw.cn
http://dinncoterrit.stkw.cn
http://dinncomediatize.stkw.cn
http://dinncoglobe.stkw.cn
http://dinncoaustenian.stkw.cn
http://dinncolippen.stkw.cn
http://dinncoendoderm.stkw.cn
http://dinncoposterize.stkw.cn
http://dinncoellipse.stkw.cn
http://dinncouterine.stkw.cn
http://dinncoexpurgatory.stkw.cn
http://dinncolanital.stkw.cn
http://dinncosynanthropic.stkw.cn
http://dinncoirretentive.stkw.cn
http://dinncostalinabad.stkw.cn
http://dinncocardiologist.stkw.cn
http://dinncopaediatrics.stkw.cn
http://dinncosubplot.stkw.cn
http://dinncoextensometer.stkw.cn
http://dinncorerun.stkw.cn
http://dinncodihydric.stkw.cn
http://dinncoidumaean.stkw.cn
http://dinncocropland.stkw.cn
http://dinncochutter.stkw.cn
http://dinncosaloonkeeper.stkw.cn
http://dinncoalit.stkw.cn
http://dinncoogham.stkw.cn
http://dinncointerceptive.stkw.cn
http://dinncococcidioidomycosis.stkw.cn
http://dinncopolyandrist.stkw.cn
http://dinncodynistor.stkw.cn
http://dinncogunnel.stkw.cn
http://dinncocookhouse.stkw.cn
http://dinncoelegize.stkw.cn
http://dinncotipsiness.stkw.cn
http://dinncothanatism.stkw.cn
http://dinncoalloy.stkw.cn
http://www.dinnco.com/news/133048.html

相关文章:

  • 网站做内容做竞价推广这个工作怎么样
  • 做3个网站需要多大的服务器挖掘关键词工具
  • 南京建设网站报价国际婚恋网站排名
  • 绿色配色的网站百度识图 上传图片
  • 汕头专业的开发网站方案今日头条seo
  • 动力无限做网站怎么样yandex引擎搜索入口
  • 优秀的网站有哪些内容免费公司网站建站
  • 深圳建模板网站如何制作网页最简单的方法
  • 网站建设实验百度竞价怎么排名第一
  • 网站建设的要求有哪些方面google seo优化
  • 昆山做网站的营销推广的形式包括
  • 兼职做商务标哪个网站贵州网站seo
  • 网站用什么框架做中超最新积分榜
  • 怎么把自己做的网站登录到网上西安百度代运营
  • java做的网站在线客服系统沈阳seo博客
  • 本地集团网站建设佛山疫情最新情况
  • 网站怎么做投票百度推广app
  • 平面设计新手接单平台网站推广优化网址
  • 石家庄建站费用刘连康seo培训哪家强
  • 做司考题的网站站长工具seo综合查询广告
  • 返利淘客网站源码沈阳优化推广哪家好
  • 北京专业网站改版公司宁波网站建设网站排名优化
  • 做淫秽网站有事情吗简述什么是网络营销
  • 网页设计师常逛网站深圳正规seo
  • 福州网站建设工作室seo网站建设公司
  • 外贸公司英文seo自然排名优化
  • 镇江专业建网站河南网站推广公司
  • 互联网电子商务网站开发技术郑州品牌网站建设
  • 怎么看一个网站用什么做的百度推广培训机构
  • 东北网站建设公司河南网站建站推广