FDM Group interview question

problem solving Interval merging question