Pregunta de entrevista de Amazon

A coding problem involving sorting intervals