N integers containing only 1,2 and 3

Given an integer A. Find and Return first positive A integers in ascending order containing only digits 1,2 and 3.

NOTE: all the A integers will fit in 32 bit integer.



Input Format

The only argument given is integer A.

Output Format

Find and Return first positive A integers in ascending order containing only digits 1,2 and 3.

Constraints

1 <= A <= 29500

For Example

Input 1:
    A = 3
Output 1:
    [1, 2, 3]

Input 2:
    A = 7
Output 2:
    [1, 2, 3, 11, 12, 13, 21]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving N integers containing only 1,2 and 3 on Interview Code Editor
Sign Up
to access hints and editorial solutions for N integers containing only 1,2 and 3

Discussion


Loading...
Click here to start solving coding interview questions