> For the complete documentation index, see [llms.txt](https://welchj.gitbook.io/cp-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://welchj.gitbook.io/cp-notes/misc.md).

# Misc

## Overlapping Intervals

Leetcode has a ton of problems about manipulations around intervals, especially merging.

Let's define an interval as $$\[a\_i, b\_i]$$. To detect overlapping intervals, we first sort the intervals based on the starting position. Then, two consecutive intervals intersect if  $$a\_2 < b\_1$$.

```
|________|
     |________|
```

where the second interval starts before the first one ends.

## Problems

{% embed url="<https://leetcode.com/problems/insert-interval/description/>" %}

{% embed url="<https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/>" %}
