Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Number of Recent Calls
Bookmark
Brute Force
Queue
Binary Search
Input
Standard
Spread Out
Rapid
Custom
pings
=
[1, 100, 3001, 3002]
1
100
3001
3002
0
1
2
3
store every ping, then count those in the last 3000 ms
1
100
3001
3002
0
1
2
3
store every ping, then count those in the last 3000 ms
window [-2999, 1]
count =
1
j=0
1
100
3001
3002
0
1
2
3
1
≥
-2999
count it
window [-2900, 100]
t=100
1
100
3001
3002
0
1
2
3
ping(100)
window =
[-2900, 100]
window [-2900, 100]
count =
2
j=1
1
100
3001
3002
0
1
2
3
100
≥
-2900
count it
window [1, 3001]
t=3001
1
100
3001
3002
0
1
2
3
ping(3001)
window =
[1, 3001]
window [1, 3001]
count =
2
j=1
1
100
3001
3002
0
1
2
3
100
≥
1
count it
window [1, 3001]
count =
3
t=3001
1
100
3001
3002
0
1
2
3
in window:
3
return
3
window [2, 3002]
count =
0
j=0
1
100
3001
3002
0
1
2
3
1
<
2
skip
window [2, 3002]
count =
2
j=2
1
100
3001
3002
0
1
2
3
3001
≥
2
count it
window [2, 3002]
count =
3
t=3002
1
100
3001
3002
0
1
2
3
in window:
3
all pings processed
algo
master
.
io
Step:
Start: store every ping, then count how many fall in the last 3000 ms.
0 / 23
Input
Standard
Spread Out
Rapid
Custom
pings
=
[1, 100, 3001, 3002]
0 / 23
algo
master
.
io
Step:
Start: store every ping, then count how many fall in the last 3000 ms.