AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
You are given a sorted unique integer array `nums`. A *range* `[a, b]` is the set of all integers from `a` to `b` (inclusive). Return the *smallest sorted* list of ranges that cover all the numbers in the array exactly. That is, each element of `nums` is covered by exactly one of the ranges, and there is no integer `x` such that `x` is in one of the ranges but not in `nums`. Each range `[a, b]` in the list should be output as `"a->b"` if `a ≠ b`, or `"a"` if `a == b`.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.