Lexicographical Numbers

Try to solve the Lexicographical Numbers problem.

Statement

Given an integer value nn, write a function that returns all the numbers in the range 11 to nn in lexicographical orderLexicographical order, also known as dictionary order or alphabetical order, is a way of ordering sequences (such as strings) based on the order of their elements. .

Constraints:

  • 1≤n≤1031 \leq n \leq 10^3

Examples

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy