1
0
mirror of https://github.com/SunnyQjm/algorithm-review.git synced 2026-06-03 08:16:43 +08:00
This commit is contained in:
2020-06-29 11:59:27 +08:00
parent 6aa2d8e276
commit 19ea28c387
+4
View File
@@ -131,7 +131,11 @@ class Solution:
# 将比待插入值小的右出队
while window and nums[window[-1]] <= x:
window.pop()
# 将当前索引加入到队列当中
window.append(i)
# 索引大于等于k-1时,每轮产生一个当前窗口最大值,放到结果集当中
if i >= k - 1:
res.append(nums[window[0]])
return res