Sorted Numbers

Solve a medium-level problem of sorting numbers in range in lexicographical order using tries.

Problem statement

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

Example 1

Sample input

Get hands-on with 1400+ tech skills courses.