educative.io

Educative

There can be More cases to be considered

There can be more cases possible and need to be consider in code

  1. What if both the start and end of an interval is same eg. [3,3] , which is not a valid interval.
  2. What if the start is more than end of an interval [5,2] , we need to rearrange it in correct format. [2,5]
  3. What if the sequence of the interval is not proper before merging and even after merging, we need to sort the intervals before returning. eg. [1,3], [8,10], [4,7]

Hi @Kshitij_Sawale
Can you please specify the lesson here?

I tried earlier also to mention the question in my last post and I thought mentioned it in the tags but its not there…

I am talking about the merge interval problem given in the “Grooking coding interview pattern in java” in the merge interval lesson.

One more thing to add to my previous post, if we are not considering the cases in the solution as I mentioned, then that should be handled in the constraints I think.