


Given :-
‘N’ = 218
Then the answer will be true because it can be rearranged to 128, which is 2 raised to the power of 7.
The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘T’ lines of the test case contain exactly one integer, ‘N’ the number given to us.
For each test case, print 1 or 0 depicting if it is possible or impossible to rearrange the given number as a power of 2, respectively.
The output of each test case will be printed in a separate line.
You don't have to print anything; It has already been taken care of. Just implement the given function.
1 <= T <= 10
0 <= N <= 10 ^ 9
Time limit: 1 sec
The main idea is to convert ‘N’ to a string ‘S’ and sort its characters. Then for all possible permutations, check if the current permutation is a power of 2.
The main idea is to create a frequency table, ‘COUNT_ARRAY’, of the number ‘N’, which stores the frequency of each digit in the number. Then for every power 2 in the range of 1 to 10 ^ 9, check if the ‘COUNT_ARRAY’ matches the frequency table of the current element.
Pair Product Div by K
Pair Product Div by K
Merge Two Sorted Arrays Without Extra Space
Merge Two Sorted Arrays Without Extra Space
Co-Prime
First Digit One
Special Digit Numbers