Interval Problems

Intervals appear constantly in interviews. Merge overlapping intervals, insert intervals, and cover intervals with minimum points.

44 lessons
106 min
Codeforces: 1000-1600LeetCode: 1400-1700

Lessons

1. Intro

The interval pattern

2m

2. The Interval Pattern

Sort first, scan second

3m

3. Problem - Merge Intervals

Combine overlapping

3m1 problems

4. Merge Intervals - The Idea

Sort by start

3m

5. Merge Intervals - Algorithm

Step by step

3m

6. Merge Intervals - Walkthrough

Tracing the algorithm

3m

7. Merge Intervals - Implementation

The code

3m1 problems

8. Quiz: Merge Intervals

Test your understanding

1m1 problems

9. Problem - Insert Interval

Add without overlap

3m1 problems

10. Insert Interval - Algorithm

Three phases

3m

11. Insert Interval - Implementation

The code

3m1 problems

12. Lessons from Merge and Insert

Key patterns

2m

13. Problem - Interval List Intersections

Two sorted lists

3m1 problems

14. Interval Intersections - Algorithm

Two-pointer approach

3m

15. Interval Intersections - Implementation

The code

3m1 problems

16. Quiz: Interval Intersections

Apply the algorithm

1m1 problems

17. Problem - Remove Covered Intervals

Eliminate redundancy

3m1 problems

18. Remove Covered - Algorithm

Sort and track

3m

19. Remove Covered - Implementation

The code

3m1 problems

20. Problem - Minimum Intervals to Cover

Cover a range

3m1 problems

21. Minimum Cover - Algorithm

Greedy extension

4m

22. Minimum Cover - Implementation

The code

3m1 problems

23. Quiz: Interval Covering

Apply the pattern

1m1 problems

24. Why Sort by End Time?

The selection key

2m

25. Quiz: Sort Order Choice

When to use which

1m1 problems

26. Problem - Non-overlapping Intervals

Minimum removals

2m1 problems

27. Non-overlapping - The Idea

Maximize to minimize

2m

28. Non-overlapping - Implementation

The code

3m1 problems

29. Problem - Meeting Rooms

Can attend all?

2m1 problems

30. Meeting Rooms - Algorithm

Overlap detection

2m

31. Meeting Rooms - Implementation

The code

2m1 problems

32. Problem - Meeting Rooms II

Minimum rooms needed

2m1 problems

33. Meeting Rooms II - Event Sweep

Start and end events

3m

34. Meeting Rooms II - Implementation

The code

3m1 problems

35. Quiz: Meeting Rooms

Event sweep understanding

1m1 problems

36. The Sweep Line Pattern

Processing events

3m

37. Problem - My Calendar I

Online interval insertion

2m1 problems

38. My Calendar I - Algorithm

Linear vs balanced

2m

39. My Calendar I - Implementation

The code

2m1 problems

40. Interval Overlap Check

The formula

2m

41. Quiz: Interval Overlap

Testing the formula

1m1 problems

42. Comparing Interval Patterns

Know your problem type

3m

43. What is Next

Looking ahead

2m

44. Section Recap

What we learned

2m

Practice Problems

Ready to start learning?

Access all 44 lessons with interactive content and progress tracking.