Problem library

Merge Sessions

Medium
intervalssorting

Each entry of sessions is [start, end] with start <= end, the minutes a player was online. Sessions that overlap or touch (one ends exactly when the next starts) count as one continuous session.

Return the continuous sessions as [start, end] pairs sorted by start.

Examples

Input: sessions = [[1,3],[8,10],[2,6],[10,12]]
Output: [[1,6],[8,12]]
Input: sessions = [[5,5]]
Output: [[5,5]]