function solution(brown, yellow) {
var answer = [];
let total=brown+yellow;
for(let i=Math.floor(total/2);i>0;i--){
if(total%i!==0)continue;
let w=i;
let h=total/i;
if((w+h)*2-4===brown){
answer=[w,h];
break;
}
}
return answer;
}