Question d’entretien chez Amazon

Coding question about merging intervals with a twist.