LeetCode 440, Hard. Topics: Trie. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 26 parametrized pytest cases, and a playground notebook:
Problem
Given two integers n and k, return the k^th lexicographically smallest integer in the range [1, n].
Examples
Constraints
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode All. Last modified on September 7, 2026