|All-time Popular Problems|
|Find duplicates in an array|
|Triplet Sum in Array|
|Sorting Elements of an Array by Frequency|
|Search an Element in an array|
|Diameter of Binary Tree|
|Maximum of all subarrays of size k|
|Leaders in an array|
|Find median in a stream|
|Reverse a Linked List in groups of given size.|
Given a positive integer n. The problem is to print the numbers in the range 1 to n having bits in alternate pattern. Here alternate pattern means that the set and unset bits in the number occur in alternate order. For example- 5 has an alternate pattern i.e. 101.
INPUT: The first line consists of an integer T i.e. the number of test cases. Each test case has the single line input, denoting the integer n.
OUTPUT: Print all the numbers with alternate bits in the range 1 to n.
1 2 5 10
1 2 5 10 21 42