function solution(w, h) {
function gcd(a, b) {
const remainder = a%b;
if(remainder === 0) return b;
return gcd(b, remainder);
}
return w*h - (w + h - gcd(w, h));
}
remainder
는 a%b이고, 0일 때 b를 return한다.w*h
에서 위 공식을 빼주면 된다.