less than 1 minute read

You are given a list of unique integers nums. Return a sorted two dimensional list of integers where each list represents an inclusive interval summarizing integers that are contiguous in nums.

Constraints

  • n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/Contiguous-Intervals

Examples

Example 1

Input

  • nums = [1, 3, 2, 7, 6]

Output

  • answer = [[1, 3], [6, 7]]

Solution

Categories:

Updated:

Leave a comment