Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

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']