기본적인 문제 파악만 하면 쉽게 풀 수 있음
function solution(brown, yellow) {
var answer = [];
let total = brown + yellow;
for(let val = Math.ceil(Math.sqrt(total)); val <= total ; val++){
if(total % val === 0){
if((val-2) * ((total/val)-2) === yellow){
return [val, total/val];
}
}
}
return answer;
}