APAC test problem- Watson and Intervals

Editorial request for Watson and Intervals problem from APAC test round B. I solved this problem using brute force technique with complexity O(n2) but since input size is too large my solution is not working for large inputs.

Can anyone write editorial for this problem.

@sarvagya3943

Is there any other approach, I couldn’t understand this.Or if you can simplify it.