Problem of the day
The first number is 1.
This is read as “One 1”.
Hence, the second number will be 11.
The second number is read as “Two 1s”.
Hence, the third number will be 21.
The third number is read as “One 2, One 1”.
Hence, the fourth number will be 1211. And so on.
The fourth term is read as “One 1, One 2, Two 1s”.
Hence, the fifth term will be 111221. And so on.
The first line of input contains a single integer 'T', representing the number of test cases or queries to be run.
Then the test cases follow.
For each test case, the only line contains a single integer 'N'.
For each test case/query, print a single containing a single string denoting the Nth term of the sequence.
The output for every test case will be printed in a separate line.
You do not need to print anything, the output has already been taken care of. Just implement the function.
1 <= T <= 30
1 <= N <= 40
Where 'T' is the number of test cases and 'N' is the given sequence index.
Time Limit: 1 sec
3
1
2
3
1
11
21
The first term is 1.
The second term is 11.
The third term is 21.
1
6
312211