class Solution {
public int[] solution(int brown, int yellow) {
int[] answer = new int[2];
int whM = brown+yellow;
int whP = ((whM-yellow)/2)+2;
for(int w=1;w<=brown; w++){
for(int h=1; h<=w; h++){
if(w+h==whP && w*h==whM){
answer[0]=w;
answer[1]=h;
break;
}
}
}
return answer;
}
}
wh = brown+yellow
yellow = (w-2)*)(h-2) -> w+h = (wh+4-yellow)/2
돌면서 저 식 두개 만족하면 종료 ,,