DEV Community

Discussion on: Daily Challenge #294 - Sum and GCD Practice

Collapse
 
_bkeren profile image
''

If there is a combination, minimum number = gcd itself, the other number = sum - gcd

const solve = (sum,gcd) => (sum-gcd) % gcd ? -1 : [gcd,sum-gcd]
Collapse
 
willsmart profile image
willsmart

Well spotted!