<p>Given two integers n and k, return <em>an array of all the integers of length </em><code>n</code><em> where the difference between every two consecutive digits is </em><code>k</code>. You may return the answer in <strong>any order</strong>.</p>

<p>Note that the integers should not have leading zeros. Integers as <code>02</code> and <code>043</code> are not allowed.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = 3, k = 7
<strong>Output:</strong> [181,292,707,818,929]
<strong>Explanation:</strong> Note that 070 is not a valid number, because it has leading zeroes.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = 2, k = 1
<strong>Output:</strong> [10,12,21,23,32,34,43,45,54,56,65,67,76,78,87,89,98]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>2 &lt;= n &lt;= 9</code></li>
	<li><code>0 &lt;= k &lt;= 9</code></li>
</ul>

static const vector<vector<vector<int>>> diff({{{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}}, {{1}, {0, 2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {}}, {{2}, {1, 3}, {0, 4}, {5}, {6}, {7}, {8}, {9}, {}, {}}, {{3}, {2, 4}, {1, 5}, {0, 6}, {7}, {8}, {9}, {}, {}, {}}, {{4}, {3, 5}, {2, 6}, {1, 7}, {0, 8}, {9}, {}, {}, {}, {}}, {{5}, {4, 6}, {3, 7}, {2, 8}, {1, 9}, {0}, {}, {}, {}, {}}, {{6}, {5, 7}, {4, 8}, {3, 9}, {2}, {1}, {0}, {}, {}, {}}, {{7}, {6, 8}, {5, 9}, {4}, {3}, {2}, {1}, {0}, {}, {}}, {{8}, {7, 9}, {6}, {5}, {4}, {3}, {2}, {1}, {0}, {}}, {{9}, {8}, {7}, {6}, {5}, {4}, {3}, {2}, {1}, {0}}});
class Solution {
public:
    vector<int> numsSameConsecDiff(int n, int k) {
        if(n == 1)  return {1, 2, 3, 4, 5, 6, 7, 8, 9};
        vector<int> res, prev = numsSameConsecDiff(n - 1, k), temp;
        for(int num : prev){
            temp = diff[num % 10][k];
            for(int num2 : temp)    res.push_back(num * 10 + num2);
        }
        return res;
    }
};
9800