import java.util.Arrays;
class Solution {
public int solution(int[][] sizes) {
int[] maxRow = new int[1];
int[] maxCol = new int[1];
Arrays.stream(sizes).forEach(size -> {
int row = size[0];
int col = size[1];
if (row < col) {
row = size[1];
col = size[0];
}
maxRow[0] = Math.max(maxRow[0],row);
maxCol[0] = Math.max(maxCol[0],col);
});
return maxRow[0] * maxCol[0];
}
}
https://school.programmers.co.kr/learn/courses/30/lessons/86491?language=java