Created
January 9, 2019 07:59
-
-
Save seemcat/f2e923ffb1886dd0c78d8c0a0f1cbefa to your computer and use it in GitHub Desktop.
c0d3 solved in JS
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 solution = (num1, num2, common = [], i = 2) => { | |
if (num1 % i === 0 && num2 % i === 0) common.push(i); | |
if (i === num1 || i === num2) return Math.max(...common); | |
return solution(num1, num2, common, i + 1); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment