Question: ** IN JAVA** I am currently attempting to write a method with the header public int findFirstRow(int[][] matrix) this method will receive a 2D array(matrix)

** IN JAVA**

I am currently attempting to write a method with the header

public int findFirstRow(int[][] matrix)

this method will receive a 2D array(matrix) where all the entries are either 1 or 0

the method will then return the index of the row that contains the greatest number of 1's

I need the pseudo code for this as well as the overall idea of how this is done.

What I have tried so far....

did two nested for loops i and j that traverse the 2d array and when an element [i][j]==0, then oneCounter++;

the problem with this was that the nested for loops would traverse the entire 2d array and oneCounter would return

the total number of 1's in the entire array.

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 Databases Questions!