Skip to content

Instantly share code, notes, and snippets.

@TobiahRex
Created October 29, 2018 06:25
Show Gist options
  • Save TobiahRex/c127beab6ada7f18827073507720da17 to your computer and use it in GitHub Desktop.
Save TobiahRex/c127beab6ada7f18827073507720da17 to your computer and use it in GitHub Desktop.
Solution to Possible-Paths from CCI
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