Input: ARR = [4, 3, 2, 6]
Output: true
Explanation: Given array can be transformed like this [3, 6, 2, 4] which follows the rule 'ARR[2 * i + 1]' = 2 * 'ARR[2 * i]' for every 0 <= i < 'N' / 2.
The first line of input contains an integer ‘T', denoting the number of test cases.
The first line of each test case contains a single integer 'N' representing the size of the input array ‘ARR’.
The second line of each test case contains 'N' integers ‘ARR’, denoting the initial arrangement of the given array.
For each test case, print "true" if Bob can win the challenge against Alice or else print "false".
Output for each test case will be printed in a separate line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= 'N' <= 10^5
-10^9 <= 'ARR[i]'<= 10^9
Time Limit : 1 sec
So, we can greedily match every number with its double and go on till the last number. If it is impossible to match the current number, then we will return false.
We will start matching the numbers from the smallest number.
Algorithm :