public static int[] maxIncol(int[][] arr) {
int[] res = arr[0];
int[] temp;
for (int i=1; i<arr.length; i++) {
temp = arr[i];
if (res.length < temp.length) {
for (int j=0; j<res.length; j++) {
temp[j] = Math.max(res[j], temp[j]);
}
res = temp;
} else {
for (int j=0; j<temp.length; j++) {
res[j] = Math.max(res[j], temp[j]);
}
}
}
return res;
}
网友评论