Problem 440 · Hard

K-th Smallest in Lexicographical Order

Return the k-th number in lexicographic order among the integers from 1 to n. The visual walks a prefix tree of decimal numbers, counting how many values fall under each prefix so whole subtrees can be skipped.

Open the interactive visualisation