Marks :10
: 2 | : 5
Given an array X and an integer N. You can perform the following operation on the array elements: for any two elements in the array (a,b) you can merge elements b into a if 2a >= b. The numbers add together if merged.
You have to perform this operation until only one element remains. Return the number of positions possible for the final number.
Constraints:
1 <= t <= 10
1<= N <= 1000000
1 <= Xi <= 10^9
First line contains integer t which is the number of test cases. For each test case:
First line contains an integer N. The next line contains N space separated integers.
For each test case output one integer. corresponding to the number of possible positions.
1 2 3 4
2
2 4 1 2 3 4 2 1 3
4 1
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.