2022-03-27 18:35:17 +08:00
< p > Given two integers < code > n< / code > and < code > k< / code > , return < em > the< / em > < code > k< sup > th< / sup > < / code > < em > lexicographically smallest integer in the range< / em > < code > [1, n]< / code > .< / p >
< 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 = 13, k = 2
< strong > Output:< / strong > 10
< strong > Explanation:< / strong > The lexicographical order is [1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9], so the second smallest number is 10.
< / 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 = 1, k = 1
< strong > Output:< / strong > 1
< / pre >
< p > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > 1 < = k < = n < = 10< sup > 9< / sup > < / code > < / li >
< / ul >