Pergunta de entrevista da empresa LinkedIn

Code questions about intervals problem. Not the same problem in LC