Skip to content

Instantly share code, notes, and snippets.

@yungyungGwon
Last active August 21, 2020 08:32
Show Gist options
  • Save yungyungGwon/e6733a728ed3e34192cf4f4965704dc5 to your computer and use it in GitHub Desktop.
Save yungyungGwon/e6733a728ed3e34192cf4f4965704dc5 to your computer and use it in GitHub Desktop.
Algorithm
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