Upwind interview question

a leetcode question of sorting intervals