Comcast Interview Question

Question related to non overlapping interval