Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Minimum Interval to Include Each Query
Bookmark
Input
Standard
Simple
No match
Custom
intervals
=
[[1,4],[2,4],[3,6],[4,4]]
,
queries
=
[2, 3, 4, 5]
intervals
[1,4]
[2,4]
[3,6]
[4,4]
1
2
3
4
5
6
heap (size, right):
empty
queries
2
q[0]
3
q[1]
4
q[2]
5
q[3]
result
?
r[0]
?
r[1]
?
r[2]
?
r[3]
algo
master
.
io
Step:
Find the smallest interval containing each query
0 / 23
Input
Standard
Simple
No match
Custom
intervals
=
[[1,4],[2,4],[3,6],[4,4]]
,
queries
=
[2, 3, 4, 5]
0 / 23
intervals
[1,4]
[2,4]
[3,6]
[4,4]
1
2
3
4
5
6
heap (size, right):
empty
queries
2
q[0]
3
q[1]
4
q[2]
5
q[3]
result
?
r[0]
?
r[1]
?
r[2]
?
r[3]
algo
master
.
io
Step:
Find the smallest interval containing each query