2023-12-09 18:42:21 +08:00
< 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 >
2022-03-27 18:35:17 +08:00
2023-12-09 18:42:21 +08:00
< p > Note that the integers should not have leading zeros. Integers as < code > 02< / code > and < code > 043< / code > are not allowed.< / p >
2022-03-27 18:35:17 +08:00
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 18:35:17 +08:00
< 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 >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 18:35:17 +08:00
< 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 > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > 2 < = n < = 9< / code > < / li >
< li > < code > 0 < = k < = 9< / code > < / li >
< / ul >