Walk through and explain your online assessment solution.
Asked in the OA review round stage. This was a separate interview dedicated to the Codility submission.
For the implementation portion, use merge_intervals(intervals). Given a list of inclusive integer intervals, return a new list with all overlapping or touching intervals merged. Explain the algorithm, correctness, complexity, and edge cases.
Input: A list of [start, end] pairs.
Output: A list of merged intervals sorted by start value.
def merge_intervals(intervals):