Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Sliding Window Median
Bookmark
Input
Example 1
Example 2
Small k=2
Custom
nums
=
[1, 3, -1, -3, 5, 3, 6, 7]
,
k
=
3
nums:
1
0
3
1
-1
2
-3
3
5
4
3
5
6
6
7
7
keep each window split into two balanced halves, median at the boundary
algo
master
.
io
Step:
Start: slide a window of k = 3 over nums, tracking each window's median
0 / 22
Input
Example 1
Example 2
Small k=2
Custom
nums
=
[1, 3, -1, -3, 5, 3, 6, 7]
,
k
=
3
0 / 22
nums:
1
0
3
1
-1
2
-3
3
5
4
3
5
6
6
7
7
keep each window split into two balanced halves, median at the boundary
algo
master
.
io
Step:
Start: slide a window of k = 3 over nums, tracking each window's median