NeetCode #931LC-386MediumMath & Geometry
← Back to All Problems#931 · #386 · Lexicographical Numbers(字典序排数)
📌 Problem Statement & Constraints
Given an integer
n, return all integers from 1 to n sorted in lexicographical order. The solution should run in O(n) time and use O(1) extra space excluding the output. Constraints: 1 <= n <= 5 * 10^4.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!