Sequential Digits
MediumMathmath
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
An integer has *sequential digits* when every digit is exactly one more than the digit before it, such as 123 or 6789.
Given low and high, return every integer in the inclusive range [low, high] that has sequential digits, sorted in ascending order.
Examples
Input: low = 100, high = 300
Output: [123,234]
Two-digit candidates are below 100 and `345` is above 300.
Input: low = 1000, high = 13000
Output: [1234,2345,3456,4567,5678,6789,12345]
All four-digit sequential numbers qualify, plus `12345`, which is at most 13000.
Constraints
- 10 <= low <= high <= 10^9
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.