Programming interview questions

Looking for good programming/interview questions?

Use the search below to find our solutions for selected questions!

Summary ranges challenge

Sharing is caring!

Problem statement
Given a sorted integer array without duplicates, return the summary of its ranges for consecutive numbers.

For example, given [0,1,2,4,5,7], return [0\rightarrow 2,4\rightarrow 5,7].