프로그래머스 : 최소직사각형

김아무개·2023년 4월 7일
0

프로그래머스

목록 보기
27/41

내 코드

class Solution {
    public int solution(int[][] sizes) {
        int maxW = -1, maxH = -1;
        for (int[] s: sizes) {
            maxW = Math.max(maxW, (s[0] < s[1]) ? s[1] : s[0]);
            maxH = Math.max(maxH, (s[0] < s[1]) ? s[0] : s[1]);
        }
        return maxW * maxH;
    }
}




슬럼프에서 아직 못빠져나와서 이거 한 문제만 풂..😔

profile
Hello velog! 

0개의 댓글