Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
My Calendar I
Bookmark
Linear Scan
Binary Search
Balanced BST
Input
Example 1
No Overlaps
Adjacent
Custom
operations
=
[MyCalendar, book, book, book]
,
values
=
[null, 10,20, 15,25, 20,30]
MyCalendar
calendar is empty
10
15
20
25
30
end
Booked
Attempt
Comparing
Overlap
Added
MyCalendar
calendar is empty
10
15
20
25
30
end
Booked
Attempt
Comparing
Overlap
Added
book(10, 20)
[10, 20]
10
15
20
25
30
end
Booked
Attempt
Comparing
Overlap
Added
book(10, 20) = true
[10, 20]
10
15
20
25
30
10-20
end
Booked
Attempt
Comparing
Overlap
Added
book(15, 25)
[15, 25]
[10, 20]
10
15
20
25
30
10-20
end
Booked
Attempt
Comparing
Overlap
Added
book(15, 25)
[15, 25]
[10, 20]
10
15
20
25
30
10-20
end
i
i = 0
Booked
Attempt
Comparing
Overlap
Added
book(15, 25) = false
[15, 25]
[10, 20]
10
15
20
25
30
10-20
end
i
i = 0
Booked
Attempt
Comparing
Overlap
Added
book(20, 30)
[20, 30]
[10, 20]
10
15
20
25
30
10-20
end
i
i = 0
Booked
Attempt
Comparing
Overlap
Added
book(20, 30)
[20, 30]
[10, 20]
10
15
20
25
30
10-20
end
i
i = 0
Booked
Attempt
Comparing
Overlap
Added
book(20, 30) = true
[10, 20]
[20, 30]
10
15
20
25
30
10-20
20-30
end
Booked
Attempt
Comparing
Overlap
Added
MyCalendar
[10, 20]
[20, 30]
10
15
20
25
30
10-20
20-30
end
Booked
Attempt
Comparing
Overlap
Added
algo
master
.
io
Step:
Start with an empty list of bookings
0 / 13
Input
Example 1
No Overlaps
Adjacent
Custom
operations
=
[MyCalendar, book, book, book]
,
values
=
[null, 10,20, 15,25, 20,30]
0 / 13
algo
master
.
io
Step:
Start with an empty list of bookings