An&nbsp;integer has sequential digits if and only if each digit in the number is one more than the previous digit.

Return a sorted list of all the integers&nbsp;in the range [low, high]&nbsp;inclusive that have sequential digits.

&nbsp;
Example 1:
Input: low = 100, high = 300
Output: [123,234]
Example 2:
Input: low = 1000, high = 13000
Output: [1234,2345,3456,4567,5678,6789,12345]

&nbsp;
Constraints:


	10 &lt;= low &lt;= high &lt;= 10^9


class Solution:
    def sequentialDigits(self, low: int, high: int) -> List[int]:
        l = len(str(low))
        h = len(str(high))
        ans = []
        for i in range(l,h+1):
            for j in range(1,11-i):
                t = str(j)
                for k in range(i-1):
                    t+=str(int(t[-1])+1)
                if int(t)<=high and int(t)>=low:
                    ans.append(int(t))
        ans.sort()
        return ans
class Solution {
    public List<Integer> sequentialDigits(int low, int high) {
        int lowSize = String.valueOf(low).length(), highSize = String.valueOf(high).length();
        List<Integer> output = new ArrayList<>();

        for(int size=lowSize; size<=highSize; size++) {
            int seedNumber = getSeedNumber(size);
            int increment = getIncrement(size);
            int limit = (int)Math.pow(10,size);
            // System.out.println(seedNumber+":"+increment+":"+limit);
            while(true){
                if(seedNumber>=low && seedNumber<=high)
                    output.add(seedNumber);
                if(seedNumber%10==9 || seedNumber>high) break;
                seedNumber+=increment;
            }
        }
        return output;
    }

    private int getSeedNumber(int size) {
        int seed = 1;
        for(int i=2;i<=size;i++)
            seed=10*seed + i;
        return seed;
    }

    private int getIncrement(int size) {
        int increment = 1;
        for(int i=2;i<=size;i++)
            increment=10*increment + 1;
        return increment;
    }
}
class Solution {
public:
    vector<int> sequentialDigits(int low, int high) {
        string lf = to_string(low);
        string rt = to_string(high);
        
        vector<int> ans;
        for(int i = lf.size(); i <= rt.size(); i++){ // 字符串长度
            for(int st = 1; st <= 9; st++){
                string base(i, '0'); // "000000" i个0
                for(int j = 0; j < i; j++){
                    base[j] += st + j;
                }
                
                if(base.back() <= '9'){
                    int num = stoi(base);
                     if(low <= num && num <= high){
                         ans.push_back(num);
                     }
                }
            }
        }
        
        return ans;
    }
    
};
var sequentialDigits = function(low, high) {
    const digits = '123456789';
    const ans = [];
    
    const minLen = low.toString().length;
    const maxLen = high.toString().length;
    
    for (let windowSize = minLen; windowSize <= maxLen; ++windowSize) {
        for (let i = 0; i + windowSize <= digits.length; ++i) {
            const num = parseInt(digits.substring(i, i + windowSize));
            
            if (num >= low && num <= high) {
                ans.push(num);
            }
        }
    }
    
    
    return ans;
};
Sequential Digits