Given a collection of intervals.

How to find the longest length they cover?

Suppose the intervels :

{1,3}

{2,6}

{8,10}

{15,18}

Click this link…Then see Interval Coverage:Problem 1 option.

Given a collection of intervals.

How to find the longest length they cover?

Suppose the intervels :

{1,3}

{2,6}

{8,10}

{15,18}

Click this link…Then see Interval Coverage:Problem 1 option.

The problem is not quite clear… perhaps you can explain further or give an example? If this is a part of a question you can also provide a link to that.

2 Likes

yeap. u r r8…

Not clear… You can give a test case and the correct answer for that case.

Well the problem which you want to state is called Merging Overlapping Intervals to find minimal set of interval or simply union of all intervals. This is a very simple problem. You can follow http://www.geeksforgeeks.org/merging-intervals/

If u face any problem, u can comment

1 Like