Merge Intervals Pattern Solution with LeetCode

Day 19 Of #100DaysOfCode: #DSA: Solve leetcode problem with Merge Intervals Pattern - Insert Intervals(medium 57) Approach: - Sort the array by start time - create a temp vector/array - now iterate over intervals and check for each interval if its start time is greater then the newInterval start time if it is then add newInterval into the temp else add curr interval - now merge the intervals that are stored in temp vector/array Time Complexity: O(n logn) Space Complexity: O(n) #Coding #LearnInPublic #CodingJourney

  • text

To view or add a comment, sign in

Explore content categories