Leetcode has a ton of problems about manipulations around intervals, especially merging.
Let's define an interval as
|________|
|________|
where the second interval starts before the first one ends.
{% embed url="https://leetcode.com/problems/insert-interval/description/" %}
{% embed url="https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/" %}