Problem of the day
1 denotes the HEAD side is up.
0 denotes the TAIL side is up.
The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then, the test cases follow.
The first line of each test case or query contains an integer 'N' representing the number of coins.
The second line contains 'N' single space-separated integers (0 or 1) representing the upside of the coins.
For each test case, print the count of maximum head side up coins that can be obtained in a single line.
Output for each test case will be printed in a separate line.
You are not required to print anything, and it has already been taken care of. Just implement the function.
1 <= T <=10
1 <= N <= 10^5
0 <= arr[i] <= 1
where 'T' is the number of test cases, 'N' is the total number of coins, and 'arr[i]' denotes whether the coin is head side up or tail side up.
Time limit: 1 sec.
1
4
1 0 1 0
3
{ 1, 1, 1, 0} is one possible answer if we flip range 1-1.
2
5
0 0 1 0 1
3
1 1 1
4
3