Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6381
@blackshadows 6329
@mb1973 5388
@Quandray 5231
@akhayrutdinov 5111
@saiujwal13083 4510
@sanjay05 3762
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3357
@KshamaGupta 3318
Complete Leaderboard
Good Numbers
Easy Accuracy: 83.52% Submissions: 71 Points: 2

A number is called good if it contains only 1's and 2's. Given an integer N, the task is to find Nth good number

Note: Some good numbers are 1, 2, 11, 12, 21, 22 ........

Input:
1. The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
2. The first line of each test case contains a single integer N.


Output: For each test case, print the Nth good number
Constraints:
1. 1 <= T <= 100

2. 1 <= N <= 104

Example:
Input:

2
5
10000

Output:
21
1122211121112

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Good Numbers

Output Window