내꺼
class Solution {
public int[] solution(int brown, int yellow) {
int width = 1;
while(true){
if(yellow % width == 0){
int height = yellow/width;
int candidate = 4 + (width*2) + (height*2);
if(brown == candidate){
return new int[]{Math.max(width,height)+2,Math.min(width,height)+2};
}
}
++width;
}
}//3 8 8 + 12 //6 14 4,, 3*8 4*6 8+12+4
}
public class Solution {
public int[] solution(int brown, int yellow) {
for (int width = 3; width <= 5000; width++) {
for (int height = 3; height <= width; height++) {
int boundary = (width + height - 2) * 2;
int center = width * height - boundary;
if (brown == boundary && yellow == center) {
return new int[] {width, height};
}
}
}
return null;
}
}