Booking.comSoftware Engineer · OnsiteCodemia practiceFind connected components in interval list
Given a list of intervals, your task is to find all connected components, where two intervals are considered connected if they overlap or touch. Return a list of merged intervals representing each connected component. For example, given the input intervals [[1, 3], [2, 4], [5, 7]], the output should be [[1, 4], [5, 7]].