-
Notifications
You must be signed in to change notification settings - Fork 4
/
prob4.txt
executable file
·29 lines (27 loc) · 884 Bytes
/
prob4.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<h2>4.Merge Overlapping Intervals</h2>
<p>Given a collection of intervals, merge all overlapping intervals.</p>
<p>You will be given Array Of Structure or Array of Object as input </p>
<p>Implement a function Merge() that will return merged Values </p>
<pre>
Definition for an interval.
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
</pre>
<b>Example 1:</b>
<pre>
Given [ (1,3),(2,6),(8,10),(15,18) ],
return [ (1,6),(8,10),(15,18) ].
</pre>
<b>Example 2:</b>
<pre>
Given [(1, 10), (2, 9), (3, 8), (4, 7), (5, 6), (6, 6)],
return [(1,10)].
</pre>
<p>Make sure the returned intervals are sorted.</p>
<b>Marks Evaluation :</b>
<p>Time Complexity: O(nlogn) - Full Marks</p>
<p>otherwise Your Marks will be inversely proportional to Time Complexity of Solution</p>