Missing Ranges
Easy · Intervals · about 10 minutes
Asked at Google, Meta, Amazon.
nums holds distinct integers in ascending order, all between lower and upper inclusive. List the numbers in [lower, upper] that nums does not contain, packed into as few ranges [a, b] as possible, in ascending order.