Question: in java Write a method called getIndexOfTrueColumn that takes 2 dimensional array of boolean values as a parameter, and determines which column in this 2D


in java
Write a method called getIndexOfTrueColumn that takes 2 dimensional array of boolean values as a parameter, and determines which column in this 2D array has the maximum number of elements equal to true. The method returns the index of the column that has the most elements equal to true. If there is a tie between two or more columns return the smallest index. For example, if the following 2D array was passed to the method: 0 1 2. 3 4 true true false true false 1 false false false true true 2 true false false false false Columns 0 and 3 are tied with the maximum number of elements equal to true with 2 elements each. In this case the method would return o to indicate column o has the maximum number of elements equal to true. You should check if the array is not equal to null, the length is greater than 0. Assume that there is at least one column per row, and each row has the same number of columns. You should NOT modify the array as a result of this method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
