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

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

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> low = 100, high = 300
<strong>Output:</strong> [123,234]
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> low = 1000, high = 13000
<strong>Output:</strong> [1234,2345,3456,4567,5678,6789,12345]
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>10 &lt;= low &lt;= high &lt;= 10^9</code></li>
</ul>

class Solution {
public:
    int countDigits(int n){
        int t = 0;
        while(n>0){
            t++;
            n = n/10;
        }
        return t;
    }
    vector<int> sequentialDigits(int low, int high) {
        vector<int> ans;
        int a = countDigits(low);
        int b = countDigits(high);
        
        for(int i=a;i<=b;i++){
            for(int j=1;j<=10-i;j++){
                 int d = 0;
                 int l = 1;
                 for(int k = j+i-1;k>=j;k--){
                      d = d + (k)*l;
                      l = l*10;
                 }
                 if(d>high) break;

                 if(d >= low && d <= high) ans.push_back(d);
            }
        }

        return ans;
    }
};
7600