Created
November 8, 2019 03:36
-
-
Save wicksome/f1ec29c69d99df12e910e532f6b82cbe to your computer and use it in GitHub Desktop.
Revisions
-
wicksome created this gist
Nov 8, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ publi class Solution { public int[] solution(int n, int m) { int[] answer = {gcd(n, m), lcm(n, m)}; return answer; } private int gcd(int a, int b) { // 최대공약수 while (b > 0) { int tmp = a; a = b; b = tmp % b; } return a; } private int lcm(int a, int b) { // 최소공배수 return a * b / gcd(a, b); } }