• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
January 10, 2024 |330 Views
SDE Sheet - Merge Overlapping Intervals
Description
Discussion

This video is a part of Stack and Queue topic under GFG SDE Sheet

In this problem, we are given a collection of Intervals, the task is to merge all of the overlapping Intervals.

Example :

Input:
Intervals = {{1,3},{2,4},{6,8},{9,10}}
Output: {{1, 4}, {6, 8}, {9, 10}}

Explanation: Given intervals: [1,3],[2,4],[6,8],[9,10], we have only two overlapping intervals here,[1,3] and [2,4]. Therefore we will merge these two and return [1,4],[6,8], [9,10].

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Article: https://www.geeksforgeeks.org/merging-intervals/
Problem: https://www.geeksforgeeks.org/problems/overlapping-intervals--170633/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More