# 1291. Sequential Digits

按序找到\[low, high]内所有digit满足递增的数。这样的数在整数范围内一共也就常数个，可以都列出来。也可以用BFS或string操作的方式把所有的可能遍历出来。

```cpp
class Solution {
public:
    vector<int> sequentialDigits(int low, int high) {
        queue<int> q;
        for (int i = 1; i <= 9; ++i) q.push(i);
        vector<int> res;
        while (!q.empty()) {
            auto t = q.front(); q.pop();
            if (t > high) break;
            if (t >= low && t <= high) {
                res.push_back(t);
            }
            if (t % 10 == 9) continue;
            q.push(t * 10 + t % 10 + 1);
        }
        return res;
    }
};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hao-fu-1.gitbook.io/oj/array_and_numbers/1291.-sequential-digits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
