Search
You are given an array of intervals representing the start and end of each interval. Complete the Javascript function to merge all overlapping intervals and return an array of the merged intervals.
For example: