Amazon interview question

LC Medium, a scheduling problem.