From 59755d57f28cedc466110fd2c6075f30bcfe0cd0 Mon Sep 17 00:00:00 2001 From: SkyLazy <627770537@qq.com> Date: Thu, 22 Jul 2021 17:19:15 +0800 Subject: [PATCH] =?UTF-8?q?Update=200239.=E6=BB=91=E5=8A=A8=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=9C=80=E5=A4=A7=E5=80=BC.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0239.滑动窗口最大值.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/problems/0239.滑动窗口最大值.md b/problems/0239.滑动窗口最大值.md index bb89a1ac..dedc3247 100644 --- a/problems/0239.滑动窗口最大值.md +++ b/problems/0239.滑动窗口最大值.md @@ -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(); }