function solution(brown, yellow) {
let answer = [];
let array = [];
let totalArea = brown + yellow
let yellowMeasure = []
for (let i = 1; i <= yellow; i++) {
if (yellow % i === 0) {
yellowMeasure.push(i)
}
}
for (let i = 3; i < totalArea; i++) {
for (let el of yellowMeasure) {
if (((el + 2) * (i) === totalArea) && i >= el + 2) {
answer.push([i, el+2])
break;
}
}
}
answer = answer.find((el) => (el[0] - 2) * (el[1] - 2) === yellow)
return answer;
}