Summary Ranges
Easy · Intervals · about 10 minutes
Asked at Google, Meta, Amazon, Microsoft, Bloomberg.
Given a sorted array of unique integers nums, return the smallest list of ranges that covers all the numbers exactly. Write each range [a, b] as "a->b" if a != b, or "a" if a == b.