DEV Community

loading...

Discussion on: Daily Challenge #130 - GCD Sum

Collapse
_bkeren profile image
''

JavaScript ES6

const solve = (sum,gcd) => {
if(sum%gcd) return -1;
const constantSum = sum / gcd;
return [gcd,(constantSum-1) * gcd]
}