This was the first question - image

Whereas the second question was you would be given a single integer n. You have to find all the binary representations of numbers starting from 1 to n. Concatenate them together and print the Decimal Representation of the Binary Number.
For example when n = 2 -->
1 ---> 1
2 ---> 10
Concatenate them together and the resultant string is 110.
Now (110) in Binary is 6. So 6 should be the correct answer.

Similary for input n = 3, the output was 27 .

Comments (0)