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


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

import java.math.*; class Solution { public int solution(int[][] sizes) { int answer = 0; // 긴 변은 무조건 가로 // 짧은 변은 무조건 세로 // if 덮어지지 않으면 make rectangle int maxLength = 0; int itsAnotherLength = 0; for (int i = 0 ; i<sizes.length ; i++) { if (sizes[i][0] > sizes[i][1]) { if (itsAnotherLength < sizes[i][1]) { itsAnotherLength = sizes[i][1]; } if (maxLength < sizes[i][0]) { maxLength = sizes[i][0]; } } else { if (itsAnotherLength < sizes[i][0]) { itsAnotherLength = sizes[i][0]; } if (maxLength < siz...



원문링크 : 프로그래머스 최소직사각형 - java