Class Solution
java.lang.Object
g0301_0400.s0386_lexicographical_numbers.Solution
386 - Lexicographical Numbers.<p>Medium</p>
<p>Given an integer <code>n</code>, return all the numbers in the range <code>[1, n]</code> sorted in lexicographical order.</p>
<p>You must write an algorithm that runs in <code>O(n)</code> time and uses <code>O(1)</code> extra space.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 13</p>
<p><strong>Output:</strong> [1,10,11,12,13,2,3,4,5,6,7,8,9]</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 2</p>
<p><strong>Output:</strong> [1,2]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= n <= 5 * 10<sup>4</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
lexicalOrder
-