Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bf4bda1

Browse files
马力马力
马力
authored and
马力
committed
Add C++ implementation
Signed-off-by: 马力 <mali0921@HPCL202007007deMacBook-Pro.local>
1 parent 834904d commit bf4bda1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎239_sliding_window_maximum/slide_window.cc‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ class Solution {
1515
right--;
1616
}
1717
indexes[right++] = i;
18-
18+
19+
// The last position of sliding window
1920
if (i >= k - 1) {
2021
res.push_back(nums[indexes[left]]);
2122
}
22-
23+
24+
// The length of sliding window
2325
if (i - indexes[left] + 1 >= k) {
2426
left++;
2527
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /