You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
*/
// Push everything to a queue, and deque element to form new elemnts and enque back them to queue
// Corner cases wouldbe to push 1,2,3 to vector first then form other elements with them to maintain order