Dhani interview question

Variation of interval merging: DP