Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int maxRow()
- {
- return maxRow(0, 0);
- }
- private int maxRow(int row, int maxRow)
- {
- if(row == _mat.length)
- return maxRow;
- int newMax = sumOfRow(row, 0) > sumOfRow(maxRow, 0) ? row : maxRow;
- return maxRow(row + 1, newMax);
- }
- private int sumOfRow(int row, int col)
- {
- if(col == _mat[0].length)
- return 0;
- return _mat[row][col] + sumOfRow(row, col + 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment