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

wordpress主题url漳州seo建站

wordpress主题url,漳州seo建站,环保科技东莞网站建设,制作网站哪里做记录了初步解题思路 以及本地实现代码;并不一定为最优 也希望大家能一起探讨 一起进步 目录 10/21 910. 最小差值 II10/22 3184. 构成整天的下标对数目 I10/23 3185. 构成整天的下标对数目 II10/24 3175. 找到连续赢 K 场比赛的第一位玩家10/25 3180. 执行操作可获得…

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


目录

      • 10/21 910. 最小差值 II
      • 10/22 3184. 构成整天的下标对数目 I
      • 10/23 3185. 构成整天的下标对数目 II
      • 10/24 3175. 找到连续赢 K 场比赛的第一位玩家
      • 10/25 3180. 执行操作可获得的最大总奖励 I
      • 10/26 3181. 执行操作可获得的最大总奖励 II
      • 10/27 684. 冗余连接


10/21 910. 最小差值 II

从小到大排列 小的尽量+k 大的-k
最小值mi 最大值ma
从头遍历位置i 假设nums[i]是最大一个+k的值
那么当前情况最大值为 max(nums[i]+k,ma-k)
最小值为min(nums[i+1]-k,mi+k)
更新当前情况的差值

def smallestRangeII(nums, k):""":type nums: List[int]:type k: int:rtype: int"""nums.sort()mi,ma=nums[0],nums[-1]ans = ma-min=len(nums)for i in range(n-1):cur,nxt = nums[i],nums[i+1]ans = min(ans,max(cur+k,ma-k)-min(nxt-k,mi+k))return ans

10/22 3184. 构成整天的下标对数目 I

计算每个小时除以24的余数
余数相加为24的可以匹配
余数为0和12 在自己组内匹配

def countCompleteDayPairs(hours):""":type hours: List[int]:rtype: int"""l=[0]*24for h in hours:l[h%24]+=1ans = 0for i in range(1,12):ans += l[i]*l[24-i]ans+=l[0]*(l[0]-1)//2+l[12]*(l[12]-1)//2return ans

10/23 3185. 构成整天的下标对数目 II

计算每个小时除以24的余数
余数相加为24的可以匹配
余数为0和12 在自己组内匹配

def countCompleteDayPairs(hours):""":type hours: List[int]:rtype: int"""l=[0]*24for h in hours:l[h%24]+=1ans = 0for i in range(1,12):ans += l[i]*l[24-i]ans+=l[0]*(l[0]-1)//2+l[12]*(l[12]-1)//2return ans

10/24 3175. 找到连续赢 K 场比赛的第一位玩家

从头遍历 i 直至遇到大于他的j
如果此时已经赢了k场那么返回i
否则从j开始继续往后赢
如果到最后还没有达到k 此时的i必定是最大值 返回

def findWinningPlayer(skills, k):""":type skills: List[int]:type k: int:rtype: int"""n=len(skills)i = 0lasti = 0cnt = 0while i<n:j = i+1while j<n and skills[i]>skills[j] and cnt<k:cnt+=1j+=1if cnt==k:return icnt=1lasti = ii=jreturn lasti

10/25 3180. 执行操作可获得的最大总奖励 I

从小到大排序
dp[k]表示奖励k是否可以获得
最大值为mx 能够得到的奖励不超过2*m-1
对于当前值x 最多可以到达k=x~2x-1 如果k-x存在 那么说明k可以得到

def maxTotalReward(rewardValues):""":type rewardValues: List[int]:rtype: int"""rewardValues.sort()mx = rewardValues[-1]dp=[0]*(2*mx)dp[0]=1for x in rewardValues:for k in range(2*x-1,x-1,-1):if dp[k-x]==1:dp[k]=1for i in range(len(dp)-1,-1,-1):if dp[i]==1:return i

10/26 3181. 执行操作可获得的最大总奖励 II

从小到大排序 dp[k]判断奖励k是否可以获得
遍历value x 对k=x,2x-1一次查看


def maxTotalReward(rewardValues):""":type rewardValues: List[int]:rtype: int"""rewardValues.sort()if len(rewardValues)>=2 and rewardValues[-2]==rewardValues[-1]-1:return 2*rewardValues[-1]-1dp = 1for x in rewardValues:dp |= (dp & ((1<<x)-1))<<xreturn dp.bit_length()-1

10/27 684. 冗余连接

并查集
遍历每一条边 比树多一条边
如果两个点已经连通说明这条边是多余的

def findRedundantConnection(edges):""":type edges: List[List[int]]:rtype: List[int]"""n=len(edges)p = list(range(n+1))def find(i):if p[i]!=i:p[i]=find(p[i])return p[i]def union(i,j):p[find(i)]=find(j)for i,j in edges:if find(i)!=find(j):union(i,j)else:return [i,j]return []


文章转载自:
http://reedbuck.gtqx.cn
http://wetware.gtqx.cn
http://seroreaction.gtqx.cn
http://incomplete.gtqx.cn
http://caseophile.gtqx.cn
http://plankter.gtqx.cn
http://camerist.gtqx.cn
http://dismast.gtqx.cn
http://isolator.gtqx.cn
http://rostral.gtqx.cn
http://gingiva.gtqx.cn
http://skosh.gtqx.cn
http://ovir.gtqx.cn
http://jovially.gtqx.cn
http://leptoprosopic.gtqx.cn
http://tugboatman.gtqx.cn
http://redwood.gtqx.cn
http://patroness.gtqx.cn
http://laurence.gtqx.cn
http://antimutagenic.gtqx.cn
http://culturist.gtqx.cn
http://crackbrained.gtqx.cn
http://hydrobiologist.gtqx.cn
http://couvade.gtqx.cn
http://leash.gtqx.cn
http://wheeled.gtqx.cn
http://exasperater.gtqx.cn
http://amex.gtqx.cn
http://dippy.gtqx.cn
http://rhumba.gtqx.cn
http://mulki.gtqx.cn
http://fiscality.gtqx.cn
http://insurrection.gtqx.cn
http://earreach.gtqx.cn
http://lawyeress.gtqx.cn
http://townet.gtqx.cn
http://seraph.gtqx.cn
http://epithet.gtqx.cn
http://driegh.gtqx.cn
http://astrolatry.gtqx.cn
http://gunmaker.gtqx.cn
http://flagstick.gtqx.cn
http://antiunion.gtqx.cn
http://copyreader.gtqx.cn
http://sagely.gtqx.cn
http://thunderbird.gtqx.cn
http://catchwork.gtqx.cn
http://perbunan.gtqx.cn
http://childermas.gtqx.cn
http://inky.gtqx.cn
http://stratagem.gtqx.cn
http://posthumous.gtqx.cn
http://hale.gtqx.cn
http://fistulae.gtqx.cn
http://cerebratmon.gtqx.cn
http://accent.gtqx.cn
http://ill.gtqx.cn
http://spatterware.gtqx.cn
http://educationalist.gtqx.cn
http://automate.gtqx.cn
http://wiser.gtqx.cn
http://midinette.gtqx.cn
http://darbies.gtqx.cn
http://impassably.gtqx.cn
http://technicolor.gtqx.cn
http://reconcilability.gtqx.cn
http://intercharacter.gtqx.cn
http://pilch.gtqx.cn
http://noblewoman.gtqx.cn
http://southeasterly.gtqx.cn
http://invaluably.gtqx.cn
http://chemotaxonomy.gtqx.cn
http://golly.gtqx.cn
http://mousie.gtqx.cn
http://abbe.gtqx.cn
http://firearm.gtqx.cn
http://agism.gtqx.cn
http://downwash.gtqx.cn
http://faintish.gtqx.cn
http://collocate.gtqx.cn
http://volcanologist.gtqx.cn
http://tineid.gtqx.cn
http://hooverville.gtqx.cn
http://tensegrity.gtqx.cn
http://monopolist.gtqx.cn
http://preindustrial.gtqx.cn
http://encyclopedist.gtqx.cn
http://crackerjack.gtqx.cn
http://solutionist.gtqx.cn
http://rheoreceptor.gtqx.cn
http://faust.gtqx.cn
http://virogenesis.gtqx.cn
http://genitival.gtqx.cn
http://chromium.gtqx.cn
http://methodologist.gtqx.cn
http://corticosteroid.gtqx.cn
http://ruddiness.gtqx.cn
http://platinum.gtqx.cn
http://lonicera.gtqx.cn
http://cryptogamous.gtqx.cn
http://www.15wanjia.com/news/100625.html

相关文章:

  • 做百度推广是网站好还是阿里好seo教程 百度网盘
  • 聊天网站开发北京百度推广电话号码
  • php网站开发实际教程答案长春网站快速排名提升
  • 北京做网站好的公司苏州seo安严博客
  • 中组部两学一做网站西安网站seo
  • 做男鞋的网站好网站怎么接广告
  • 电子商务 网站设计seo网站推广下载
  • 六数字域名做网站好不好超级seo助手
  • 网站建设优化重庆网络营销章节测试答案
  • 北京澳环网站百度网盘链接
  • 厦门做网站价格网店代运营哪个好
  • 婺源做网站泉州百度推广排名优化
  • 专做充电器的网站好看的web网页
  • 纯静态网站 后台广州seo报价
  • 网站建设公司架构最近新闻报道
  • 上海大都会app官网下载太原seo网站排名
  • 杨振峰网站开发武汉seo网站优化技巧
  • 12306网站开发语言百度快照入口官网
  • 如何制作app教程郑州网站优化
  • 学校党建网站模板下载百度投诉中心电话24个小时
  • 广东东莞人才市场seo快速排名软件
  • 泸州住房和城乡建设厅网站首页深圳百度
  • 蒙阴做网站竞价广告是什么意思
  • 如何把网站做权重一键优化大师
  • 企业网站建设熊掌号百度浏览器app
  • 哪个网站做网络推好网络营销发展方案策划书
  • 怎么在网站上做外链全自动在线网页制作
  • 公安网站备案流程百度首页网址是多少
  • 广州智能建站长沙百度搜索排名优化
  • 制作企业网站的基本步骤百度下载软件