mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
@ -273,8 +273,8 @@ class Solution {
|
||||
int[] res = new int[n - k + 1];
|
||||
int idx = 0;
|
||||
for(int i = 0; i < n; i++) {
|
||||
// 根据题意,i为nums下标,是要在[i - k + 1, k] 中选到最大值,只需要保证两点
|
||||
// 1.队列头结点需要在[i - k + 1, k]范围内,不符合则要弹出
|
||||
// 根据题意,i为nums下标,是要在[i - k + 1, i] 中选到最大值,只需要保证两点
|
||||
// 1.队列头结点需要在[i - k + 1, i]范围内,不符合则要弹出
|
||||
while(!deque.isEmpty() && deque.peek() < i - k + 1){
|
||||
deque.poll();
|
||||
}
|
||||
|
Reference in New Issue
Block a user