Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 393 Bytes

README.md

File metadata and controls

16 lines (10 loc) · 393 Bytes

Merge List Of Number Into Ranges

This problem was asked by Facebook.

Description

Given a sorted list of numbers, return a list of strings that represent all of the consecutive numbers.

Assume that all numbers will be greater than or equal to 0, and each element can repeat.

Example

Input:  [0, 1, 2, 5, 7, 8, 9, 9, 10, 11, 15]
Output: ['0->2', '5->5', '7->11', '15->15']