Summary Ranges
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a sorted array nums of **unique** integers. Cover every number in nums with the smallest possible list of ranges of consecutive integers, where each range contains only numbers from nums.
Return the ranges in ascending order as strings. A range [a, b] with a != b is written "a->b", and a range with a single number is written "a". An empty input produces an empty list.
Examples
Constraints
- 0 <= nums.length <= 20
- -2^31 <= nums[i] <= 2^31 - 1
- nums is sorted in strictly increasing order
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.