# Intervals

There are two types of intervals

* Overlapping intervals
* Non Overlapping intervals

They can be used to solve variety of problems:

1. **Merge Overlapping Intervals:** Given a list of intervals, merge overlapping intervals into a consolidated list of intervals. <mark style="background-color:green;">This can be used in scenarios like scheduling, time management, or resource allocation.</mark>
2. **Non-overlapping Intervals:** Given a list of intervals, find the maximum number of non-overlapping intervals that can be selected. <mark style="background-color:green;">This can be used in scenarios like task scheduling, activity selection, or maximizing resource utilization.</mark>
3. **Interval Intersection:** Given two lists of intervals, find the intersection between them. <mark style="background-color:green;">This can be used in scenarios like finding common availability slots, overlapping events, or time-based conflicts.</mark>
4. **Interval Union:** Given a list of intervals, find the union of all overlapping intervals. <mark style="background-color:green;">This can be used in scenarios like visualizing time ranges, determining the overall coverage of events, or determining the total duration of overlapping activities.</mark>
5. **Interval Difference:** Given two lists of intervals, find the difference between them (intervals present in one list but not in the other). <mark style="background-color:green;">This can be used in scenarios like finding available time slots, identifying gaps in schedules, or filtering out unwanted intervals.</mark>

## Practice Problems

1. Merge Overlapping Intervals:
   * Problem: [56. Merge Intervals](https://leetcode.com/problems/merge-intervals/)
   * Problem: [986. Interval List Intersections](https://leetcode.com/problems/interval-list-intersections/)
2. Non-overlapping Intervals:
   * Problem: [435. Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/)
   * Problem: [452. Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/)
3. Interval Intersection:
   * Problem: [986. Interval List Intersections](https://leetcode.com/problems/interval-list-intersections/)
   * Problem: [986. Interval List Intersections](https://leetcode.com/problems/interval-list-intersections/)
4. Interval Union:
   * Problem: [759. Employee Free Time](https://leetcode.com/problems/employee-free-time/)
   * Problem: [1272. Remove Interval](https://leetcode.com/problems/remove-interval/)
5. Interval Difference:
   * Problem: [56. Merge Intervals](https://leetcode.com/problems/merge-intervals/)
   * Problem: [986. Interval List Intersections](https://leetcode.com/problems/interval-list-intersections/)
