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