Question: write a cobol program using ACCEPT verb to take values from terminal like hackerrank or any online tool, read array size and binary values. calculate

write a cobol program using ACCEPT verb to take values from terminal like hackerrank or any online tool, read array size and binary values.
calculate how many minimum steps need to swap values so that all zero one side and all ones one side, any side is fine.
For example:-
Array size and values
4
0
1
0
1
output :-1
sample 2
6- array size
1
1
0
0
0
1
output:3
sample test case3
4
1
1
0
0
output 0 because already in aligned order.
sample test case 4
5
1
0
1
0
1
output 3
write cobol program test it throughly for 6 to 8 different test cases and I need to test in hackerank.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!