K-th Smallest in Lexicographical Order
Try to solve the K-th Smallest in Lexicographical Order problem.
We'll cover the following
Statement
Given two integers, n
and k
, return the [1, n]
when the numbers are sorted lexicographically.
Note: Lexicographical sorting means ordering numbers like words in a dictionary (alphabetical order)—digit by digit from left to right. For example, the numerical order of 1, 5, and 10 is [1, 5, 10], but their lexicographical order is [1, 10, 5].
Constraints:
k
n
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.