

1. Select any element from the array and increase it by ‘1’.
2. Double all the value of all the elements in the array
The first line contains an integer 'T' which denotes the number of test cases or queries to be run.
The first line of each test case contains a single integer ‘N’ denoting the size of the ‘arr’ array.
The next line contains ‘N’ space-separated integers denoting the values of elements of the ‘arr’ array.
For each test case, print a single line containing the minimum number of steps required to form the given array.
The output of each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 5000
0 <= arr[i] < 10 ^ 6
Where ‘arr[i]’ represents the elements of the array.
Time Limit: 1 sec
The idea here is that we can say that number of increment operations required are equal to the number of set bits present in the elements of a given array because in one operation you can double all elements of the array. To get an even number you need to get even / 2 i.e. half of the number. So we need Increment operations only when our current element is odd
and in all other cases, we can divide the number by 2.
The function is created to count the number of minimum operations which can be performed of incrementation to make the desired array.
The function will take one parameter:
Int element for which we count the number of operations needed.
The function is created to count the number of minimum operations which can be performed of double the elements to make the desired function.
The function will take one parameter:
Int element for which we count the number of operations required.
The idea here is to traverse the array and try to make the elements of array ‘0’ so we can think of as we know there are 2 operations that are we can increase the elements by ‘1’ or we can double them so we can use this that if we see all the elements are presents are even we can divide the elements by ‘2’ and if any odd element is present we decrease it by ‘1’ to make an even number and then divide it and in every operation, we store the count so when all elements become ‘0’ it would be the minimum number of operations.