Last active
August 21, 2020 08:32
-
-
Save yungyungGwon/e6733a728ed3e34192cf4f4965704dc5 to your computer and use it in GitHub Desktop.
Algorithm
This file contains 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
function solution(n, m){ | |
var answer = []; | |
answer[0] = solution2(n,m); | |
answer [1] = n * m / answer[0]; | |
return answer; | |
} | |
function solution2(n,m){ | |
var min = 0; | |
for(var i = 1; i <= n && i <= m; i++){ | |
if(n % i == 0 && m % i == 0){ | |
min = i; | |
} | |
} | |
return min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment