https://itsmekartikeya.medium.com/interview-question-non-overlapping-intervals-problem-array-c-b2da0f7e6e8e