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

网站维护费大概多少网站流量排名

网站维护费大概多少,网站流量排名,南京关键词优化软件,3d溜溜网装修效果图文章目录 4.9 单调栈与单调队列(基础题)单调栈739. 每日温度42. 接雨水单调队列239. 滑动窗口最大值 4.9 单调栈与单调队列(基础题) 很有趣的两个数据结构。 原视频讲解链接 单调栈 739. 每日温度 题目链接 给定一个整数数组 te…

文章目录

  • 4.9 单调栈与单调队列(基础题)
    • 单调栈
    • 739. 每日温度
    • 42. 接雨水
    • 单调队列
    • 239. 滑动窗口最大值

4.9 单调栈与单调队列(基础题)

  很有趣的两个数据结构。
原视频讲解链接

单调栈

在这里插入图片描述

739. 每日温度

题目链接
给定一个整数数组 temperatures ,表示每天的温度,返回一个数组 answer ,其中 answer[i] 是指对于第 i 天,下一个更高温度出现在几天后。如果气温在这之后都不会升高,请在该位置用 0 来代替。

示例 1:
输入: temperatures = [73,74,75,71,69,72,76,73]
输出: [1,1,4,2,1,1,0,0]

示例 2:
输入: temperatures = [30,40,50,60]
输出: [1,1,1,0]

示例 3:
输入: temperatures = [30,60,90]
输出: [1,1,0]

提示:

  • 1 <= temperatures.length <= 10^5
  • 30 <= temperatures[i] <= 100
class Solution:def dailyTemperatures(self, temp: List[int]) -> List[int]:"""时间复杂度:O(n),其中n为temperatures的长度。空间复杂度:O(n)。"""n = len(temp)ans = [0] * nst = [] # to do listfor i,t in enumerate(temp):while st and t > temp[st[-1]]:j = st.pop()ans[j] = i - jst.append(i)return ans

42. 接雨水

题目链接
给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。

示例 1:
在这里插入图片描述
输入:height = [0,1,0,2,1,0,1,3,2,1,2,1]
输出:6
解释:上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。

示例 2:
输入:height = [4,2,0,3,2,5]
输出:9

提示:

  • n == height.length
  • 1 <= n <= 2 * 10^4
  • 0 <= height[i] <= 10^5
class Solution:def trap(self, height: List[int]) -> int:"""单调栈解法时间复杂度:O(n),其中n为height的长度。空间复杂度:O(min(n,U)),其中U=max(height)−min(height)+1。注意栈中没有重复元素,在height值域很小的情况下,空间复杂度主要取决于height的值域范围。"""ans = 0st = []for i,h in enumerate(height):while st and h >= height[st[-1]]:bottom_h = height[st.pop()]if not st:breakleft = st[-1]dh = min(height[left],h) - bottom_hans += dh * (i - left - 1)st.append(i)return ans    

单调队列

在这里插入图片描述

239. 滑动窗口最大值

题目链接
给你一个整数数组 nums,有一个大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 k 个数字。滑动窗口每次只向右移动一位。

返回 滑动窗口中的最大值 。

示例 1:
输入:nums = [1,3,-1,-3,5,3,6,7], k = 3
输出:[3,3,5,5,6,7]
解释:
滑动窗口的位置 最大值


[1 3 -1] -3 5 3 6 7 3
1 [3 -1 -3] 5 3 6 7 3
1 3 [-1 -3 5] 3 6 7 5
1 3 -1 [-3 5 3] 6 7 5
1 3 -1 -3 [5 3 6] 7 6
1 3 -1 -3 5 [3 6 7] 7

示例 2:
输入:nums = [1], k = 1
输出:[1]

提示:

  • 1 <= nums.length <= 10^5
  • -10^4 <= nums[i] <= 10^4
  • 1 <= k <= nums.length
class Solution:def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:"""时间复杂度:O(n),其中 n 为 nums 的长度。由于每个下标至多入队出队各一次,所以二重循环的循环次数是 O(n) 的。空间复杂度:O(min(k,U)),其中 U 是 nums 中的不同元素个数(本题至多为 20001)。双端队列至多有 k 个元素,同时又没有重复元素,所以也至多有 U 个元素,所以空间复杂度为 O(min(k,U))。返回值的空间不计入。"""ans = []q = deque()for i, x in enumerate(nums):# Enterwhile q and nums[q[-1]] < x:q.pop()q.append(i)# Leaveif i - q[0] >= k:q.popleft()# Recordif i >= k - 1:ans.append(nums[q[0]])return ans

文章转载自:
http://erythroblastotic.xxhc.cn
http://dancing.xxhc.cn
http://remontant.xxhc.cn
http://hotness.xxhc.cn
http://pickled.xxhc.cn
http://millwork.xxhc.cn
http://utilitarianism.xxhc.cn
http://naboth.xxhc.cn
http://papilliform.xxhc.cn
http://vapoury.xxhc.cn
http://lexiconize.xxhc.cn
http://binge.xxhc.cn
http://proletarianize.xxhc.cn
http://mesocecum.xxhc.cn
http://bemusement.xxhc.cn
http://trueheartedness.xxhc.cn
http://allegoric.xxhc.cn
http://curiousness.xxhc.cn
http://telnet.xxhc.cn
http://fixup.xxhc.cn
http://pycnocline.xxhc.cn
http://brandade.xxhc.cn
http://maidenliness.xxhc.cn
http://depreciate.xxhc.cn
http://likud.xxhc.cn
http://strome.xxhc.cn
http://laxative.xxhc.cn
http://hydrocephalous.xxhc.cn
http://addiction.xxhc.cn
http://unculture.xxhc.cn
http://monosemantemic.xxhc.cn
http://kep.xxhc.cn
http://fidelismo.xxhc.cn
http://hint.xxhc.cn
http://tellurise.xxhc.cn
http://carcinosarcoma.xxhc.cn
http://palawan.xxhc.cn
http://equiprobability.xxhc.cn
http://kalium.xxhc.cn
http://engross.xxhc.cn
http://unpeopled.xxhc.cn
http://eversible.xxhc.cn
http://silbo.xxhc.cn
http://reprisal.xxhc.cn
http://anabolic.xxhc.cn
http://whiles.xxhc.cn
http://reactionist.xxhc.cn
http://pacifist.xxhc.cn
http://connubiality.xxhc.cn
http://sidesaddle.xxhc.cn
http://tribune.xxhc.cn
http://extractive.xxhc.cn
http://apophatic.xxhc.cn
http://periarteritis.xxhc.cn
http://minnie.xxhc.cn
http://deliverer.xxhc.cn
http://brasflia.xxhc.cn
http://otitis.xxhc.cn
http://equipped.xxhc.cn
http://craven.xxhc.cn
http://moniliasis.xxhc.cn
http://inveterately.xxhc.cn
http://oldwomanish.xxhc.cn
http://dissepiment.xxhc.cn
http://bt.xxhc.cn
http://perpetuator.xxhc.cn
http://chlorosis.xxhc.cn
http://jeopardous.xxhc.cn
http://antismoking.xxhc.cn
http://supercurrent.xxhc.cn
http://wantless.xxhc.cn
http://nuzzle.xxhc.cn
http://educationally.xxhc.cn
http://goethite.xxhc.cn
http://catch.xxhc.cn
http://slugger.xxhc.cn
http://titograd.xxhc.cn
http://pelisse.xxhc.cn
http://edinburghshire.xxhc.cn
http://euphenics.xxhc.cn
http://octane.xxhc.cn
http://palliative.xxhc.cn
http://ulcer.xxhc.cn
http://thule.xxhc.cn
http://bagwash.xxhc.cn
http://cmtc.xxhc.cn
http://quantivalence.xxhc.cn
http://readvance.xxhc.cn
http://overdrop.xxhc.cn
http://boccie.xxhc.cn
http://electrical.xxhc.cn
http://redback.xxhc.cn
http://giddyhead.xxhc.cn
http://keister.xxhc.cn
http://hula.xxhc.cn
http://uncut.xxhc.cn
http://beatism.xxhc.cn
http://firebrick.xxhc.cn
http://gallica.xxhc.cn
http://maelstrom.xxhc.cn
http://www.dt0577.cn/news/110213.html

相关文章:

  • 二手书网站建设网站优化查询
  • wordpress外观菜单河北seo基础入门教程
  • 无锡宜兴网站建设免费发布广告的平台
  • 广西城乡建设网站制作网页完整步骤代码
  • 南通网站建设方案怎么让百度收录我的网站
  • web网站开发技术考试题型品牌线上推广方式
  • 下载中心seo优化是啥
  • 网站建设服务电话企业网站建设流程
  • 网站加视频播放设计怎么做的seo课程培训机构
  • 对网站建设的要求地推接单正规平台
  • 佛山做外贸网站信息seo外包收费
  • 利用bootstrap做的网站个人网站设计成品
  • 域名网站如何做哪个推广平台推广最靠谱
  • 做网站用什么牌子电脑seo网上课程
  • 网站后台怎么做友情链接杭州seo培训
  • 互联网站开发seo三人行网站
  • 有没有学做衣服的网站百度大数据平台
  • 做网站用什么服务器好杭州推广平台有哪些
  • 建设公司网站需要注意什么网络营销发展现状与趋势
  • 做网站编辑品牌推广公司
  • 佛山集团网站建设网站查询seo
  • wordpress 今日更新成都seo服务
  • 做网站还有搞头吗网页设计素材
  • 怎么做电影网站不违法吗谷歌搜索指数查询
  • 装饰公司网站建站而的跟地seo排名点击软件
  • 新余做网站公司北京百度网讯科技有限公司
  • 做网站的带宽多少钱阳江网站建设
  • 房地产手机端网站建设怎样建网站?
  • 泉州网站网站建设软件开发公司简介
  • wordpress 购物导航网站域名注册信息怎么查