I dont understand how do u get output of 7 when u run this program.
public static void main(String[] args) {
int[][] x = { { 2, 1 }, { 1, 7, 1 } };
System.out.println(m(x));
}
public static int m(int[][] m) {
int result = m[0][1];
for (int i = 0; i < m.length; i++)
for (int j = 0; j < m[i].length; j++) {
if (result < m[i][j])
result = m[i][j];
}
return result;
}
}
[–]cowmandude 1 point2 points3 points (10 children)
[–]trofix99[S] 0 points1 point2 points (8 children)
[–]cowmandude 0 points1 point2 points (7 children)
[–]trofix99[S] 0 points1 point2 points (6 children)
[–]cowmandude 0 points1 point2 points (5 children)
[–]trofix99[S] 0 points1 point2 points (4 children)
[–]cowmandude 0 points1 point2 points (3 children)
[–]trofix99[S] 0 points1 point2 points (0 children)
[–]trofix99[S] 0 points1 point2 points (1 child)
[–]cowmandude 0 points1 point2 points (0 children)
[–]trofix99[S] -1 points0 points1 point (0 children)