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

wordpress 站外调用网站如何优化流程

wordpress 站外调用,网站如何优化流程,怎么做能上谷歌网站,discuz 网站备案信息代码记录了初步解题思路 以及本地实现代码#xff1b;并不一定为最优 也希望大家能一起探讨 一起进步 目录 1/1 1599. 经营摩天轮的最大利润1/2 466. 统计重复个数1/3 2487. 从链表中移除节点1/4 2397. 被列覆盖的最多行数1/5 1944. 队列中可以看到的人数1/6 2807. 在链表中插入最…记录了初步解题思路 以及本地实现代码并不一定为最优 也希望大家能一起探讨 一起进步 目录 1/1 1599. 经营摩天轮的最大利润1/2 466. 统计重复个数1/3 2487. 从链表中移除节点1/4 2397. 被列覆盖的最多行数1/5 1944. 队列中可以看到的人数1/6 2807. 在链表中插入最大公约数1/7 383. 赎金信 1/1 1599. 经营摩天轮的最大利润 如果4个人的钱小于运行的钱 则必定亏本 依次遍历每个时间点的游客 wait记录当前等待游客数量 ans记录最大利润时的经营时间 cur记录当前利润 maxv记录最大利润 当没有后续游客时 继续考虑等待的游客 每次上4人使得利润最大化 def minOperationsMaxProfit(customers, boardingCost, runningCost)::type customers: List[int]:type boardingCost: int:type runningCost: int:rtype: intif 4*boardingCostrunningCost:return -1wait 0ans -1cur -999maxv -999num 0for cus in customers:wait custmp min(4,wait)wait -tmpcur tmp*boardingCost-runningCostnum 1if curmaxv:maxv curans numwhile wait0:tmp min(4,wait)wait -tmpcur tmp*boardingCost-runningCostnum 1if curmaxv:maxv curans numreturn ans 1/2 466. 统计重复个数 从1个s1开始寻找s2 不停的添加s1 寻找到能够开始循环的地方 def getMaxRepetitions(s1, n1, s2, n2)::type s1: str:type n1: int:type s2: str:type n2: int:rtype: intif n10:return 0s1cnt,ind,s2cnt 0,0,0m {}while True:s1cnt 1for c in s1:if cs2[ind]:ind1if indlen(s2):s2cnt1ind0if s1cntn1:return s2cnt//n2if ind in m:s1p,s2p m[ind]pre (s1p,s2p)nxt (s1cnt-s1p,s2cnt-s2p)breakelse:m[ind] (s1cnt,s2cnt)ans pre[1](n1-pre[0])//(nxt[0])*nxt[1]l (n1-pre[0])%nxt[0]for i in range(l):for c in s1:if cs2[ind]:ind1if indlen(s2):ans1ind0return ans//n2 1/3 2487. 从链表中移除节点 递归 对右侧进行操作 class ListNode(object):def __init__(self, val0, nextNone):self.val valself.next next def removeNodes(head)::type head: Optional[ListNode]:rtype: Optional[ListNode]def do(node):if node is None:return Nonenode.next do(node.next)if node.next and node.valnode.next.val:return node.nextelse:return nodereturn do(head) 1/4 2397. 被列覆盖的最多行数 枚举每一种情况 cur为选取的状态 1为选择 0位不选 每一行使用二进制表示 mask[i] 与cur相与如果数值不变说明所有1都被覆盖了 def maximumRows(matrix, numSelect)::type matrix: List[List[int]]:type numSelect: int:rtype: intm,nlen(matrix),len(matrix[0])mask [sum(vj for j,v in enumerate(row)) for i,row in enumerate(matrix)]ans,limit 0,1nfor cur in range(1,limit):if cur.bit_count()!numSelect:continuet sum((mask[j]cur)mask[j] for j in range(m))ans max(ans,t)return ans 1/5 1944. 队列中可以看到的人数 从最右侧开始考虑 对于右侧不高于自己的人 左侧的人必定看不到 维护一个单调栈 递减 忽略不高于自己的人 def canSeePersonsCount(heights)::type heights: List[int]:rtype: List[int]st[]n len(heights)ans [0]*nfor i in range(n-1,-1,-1):cur heights[i]while st and curst[-1]:ans[i]1st.pop()if st:ans[i]1st.append(cur)return ans 1/6 2807. 在链表中插入最大公约数 遍历每一个节点 在节点后插入公约数 下一步跳过最新插入的节点 class ListNode(object):def __init__(self, val0, nextNone):self.val valself.next next def insertGreatestCommonDivisors(head)::type head: Optional[ListNode]:rtype: Optional[ListNode]import mathnode headwhile node.next is not None:node.next ListNode(math.gcd(node.val, node.next.val), node.next)node node.next.nextreturn head 1/7 383. 赎金信 记录magazine中的字符个数 遍历ransom检查是否满足 def canConstruct(ransomNote, magazine)::type ransomNote: str:type magazine: str:rtype: boolif len(magazine)len(ransomNote):return Falsefrom collections import defaultdictm defaultdict(int)for c in magazine:m[c]1for c in ransomNote:m[c]-1if m[c]0:return Falsereturn True
http://www.hkea.cn/news/14544008/

相关文章:

  • 做竞价网站需要什么样的空间上海建设工程咨询网 首页
  • 直播网站app下载充值网站架设
  • 做网站购买服务器html链接网站模板
  • 网站开发软件的选择网络营销策划书封面
  • 网站开发风险分析郑州高新区建设环保局网站
  • 建一个商业网站要多少钱游戏开发app
  • 网站策划方案书的内容建设网站什么软件好
  • 做网站方面的问题速成网站怎么做
  • 江苏水利工程建设局网站网站的关键词库怎么做的那么多
  • 临沂企业建站效果好用discuz怎样做网站
  • 深圳自助体检机地址seo狂人
  • 邯郸做网站的公司哪家好重庆渝北网站建设
  • 在线教育网站怎么做包牛牛网站怎么做
  • 做网站的公司怎么发展业务厦门网站制作建设
  • 怎么查公司网站有没有被收录今天军事新闻
  • 网站建设网站美工工作计划wordpress 多语言插件
  • 提供手机自适应网站建设项目管理软件的分类
  • 建设网站重庆施工企业企业管理费
  • 怎么在网站上建设投票统计山西省建设厅招标网站首页
  • 网站建设网点东莞服务36招全称
  • 门户网站内容建设王也个人资料
  • 房地产网站建设存在问题扶贫工作网站怎么做
  • 网站 备案 多久中国电信软件开发工程师待遇
  • 网站相关知识株洲定制型网站建设
  • 中国建设银行公积金网站首页做百度网站一般多少钱
  • wordpress门户网站主题风险报告查询系统
  • 襄阳网站seo方法民宿平台搜索量上涨
  • 网站建设飠金手指下拉省工程建设信息网
  • 做网站需要服务器网页游戏源码交易平台
  • 婚庆企业网站建设wordpress 同步预览