Challenge:​ Generate Binary Numbers From 1 to n Using Queue

Can you generate binary numbers from 1 to any given number "n"?

Problem Statement

Implement a function findBin(n), which will generate binary numbers from 11 to nn in the form of a string using a queue. An illustration is also provided for your understanding.

Input

A positive integer nn

Output

Returns binary numbers in the form of strings from 1 up to n

Sample Input

n = 3

Sample Output

result = ["1","10","11"]

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.