← ALL NOTES
Trie

440. K-th Smallest in Lexicographical Order

Find the k-th number in 1..n under lexicographic (dictionary) order, without generating the list — n and k can be huge. Same decimal-trie structure as #386 (dictionary order = pre-order of the 10-ary…

Loading…