Created
October 29, 2018 06:25
-
-
Save TobiahRex/c127beab6ada7f18827073507720da17 to your computer and use it in GitHub Desktop.
Solution to Possible-Paths from CCI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gcd = (n1, n2) => { | |
if (n2 === 0) return n1; | |
return gcd(n2, n1 % n2); | |
} | |
const main = (input) => { | |
if (gcd(input[0], input[1]) == gcd(input[2], input[3])) { | |
return 'YES'; | |
} else return 'NO'; | |
} | |
console.log( | |
main([2, 8, 18, 20]) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment