Problem 2545. compress sequence into intervals

Created by Guillaume in Community

You're given a row vector of monotonically increasing integers most of which are consecutive. Find the upper and lower bounds of each run in that vector and return that as a row vector of intervals.

Note: this is the inverse of problem 2528 - Expand intervals.

Solution Stats

58.46% Correct | 41.54% Incorrect
Last solution submitted on Feb 24, 2019