Lexicographical Numbers | Leetcode 386 | Interview Question for DSA

Опубликовано: 26 Июль 2026
на канале: Moody Vish
156
1

Problem URL : https://leetcode.com/problems/lexicog...

Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order.

You must write an algorithm that runs in O(n) time and uses O(1) extra space.


Watch related videos:
▶ Find Valid Matrix Given Row and Column Sums | Leetcode 1605 | Interview Question for DSA -    • Find Valid Matrix Given Row and Column Sum...  
▶ Lucky Numbers in a Matrix | Leetcode 1380 | Interview Question for DSA -    • Lucky Numbers in a Matrix | Leetcode 1380 ...  
▶ Distribute Coins in Binary Tree | Leetcode 979 | Interview Question for DSA -   • Distribute Coins in Binary Tree | Leetcode...