2D Array Column Maximum
Given a method designed to find the maximum value in any column of a 2D integer array data, choose the correct code to complete the method implementation.
public int findMaxInColumn(int[][] data, int col) {
int max = Integer.MIN_VALUE;
for (int row = 0; row < data.length; row++) {
// missing code
}
return max;
}
Which of the following options will accurately complete the method to find the maximum value in the specified column?
A
max = Math.max(max, data[data.length - 1][col]);
B
max = Math.max(max, data[0][col]);
C
max = Math.max(max, data[col][row]);
D
max = Math.max(max, data[row][col]);
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE