Sorted Integers With Consecutively Increasing Digits
Quick Overview
Sorted Integers With Consecutively Increasing Digits. Return every integer in the inclusive range[low,high] whose decimal digits each increase by exactly1 from the preceding digit.
Sorted Integers With Consecutively Increasing Digits
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
### Problem
Return every integer in the inclusive range [low,high] whose decimal digits each increase by exactly 1 from the preceding digit. Return them in increasing order. Digits do not wrap from 9 to 0.
```cpp
class Solution {
public:
vector<int> sequentialDigits(int low, int high);
};
```
### Examples
**Example 1:**
```text
Input: low = 50, high = 100
Output: [56,67,78,89]
Explanation: These are exactly the increasing consecutive two-digit strings in range.
```
**Example 2:**
```text
Input: low = 101, high = 122
Output: []
Explanation: The first eligible three-digit number is123, beyond high.
```
### Constraints
- `10 <= low <= high <= 1000000000`.
### Contract considerations
The original lower bound 10 excludes single-digit outputs, and the sorted result is deterministic.
```hint Read the boundary condition
Are the range endpoints included, and may a digit sequence continue from 9 to 0?
```
### Boundary reminders
The original lower bound 10 excludes single-digit outputs, and the sorted result is deterministic.
Overview: Sorted Integers With Consecutively Increasing Digits. Return every integer in the inclusive range[low,high] whose decimal digits each increase by exactly1 from the preceding digit.
Sorted Integers With Consecutively Increasing Digits
Google
Source window: 0–6 months · as of Oct 21, 2026
mediumSoftware EngineerOtherCoding & Algorithms
0
0
Problem
Return every integer in the inclusive range [low,high] whose decimal digits each increase by exactly 1 from the preceding digit. Return them in increasing order. Digits do not wrap from 9 to 0.
class Solution {
public:
vector<int> sequentialDigits(int low, int high);
};
Examples
Example 1:
Input: low = 50, high = 100
Output: [56,67,78,89]
Explanation: These are exactly the increasing consecutive two-digit strings in range.
Example 2:
Input: low = 101, high = 122
Output: []
Explanation: The first eligible three-digit number is123, beyond high.
Constraints
10 <= low <= high <= 1000000000
.
Contract considerations
The original lower bound 10 excludes single-digit outputs, and the sorted result is deterministic.
Boundary reminders
The original lower bound 10 excludes single-digit outputs, and the sorted result is deterministic.