i have to write a method,
The method receives a parameter of two-dimensional array of integers. The method returns the number of the row which has the highest sum of the integers.I’m allowed to use only recursion! no loops allowed!-of course i need to make a private method that will sum a row as a single array and then i have to do another private method that compares the rows, but it doesn’t really work since the method i wrote is only for a 1d array, and i need to compare a row from a 2d array..
appreciate all kind of help..
some of my code:
private int rowSum(int[] array, int index) {//the sum of an array(1d array)
if (index == array.length)
return 0;
else
return array[index] + rowSum(array, index + 1);
}
**public int maxRow(int[][] a){------!!!---the problem...
}**
Code: