Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c64d493

Browse files
solve: 분수의 덧셈
1 parent fb0b1d7 commit c64d493

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎Level0/PRO120808.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Solution 1
2+
const getGreatestCommonDivisor = (num1, num2) => {
3+
return num2 === 0 ? num1 : getGreatestCommonDivisor(num2, num1 % num2);
4+
};
5+
6+
const solution = (numer1, denom1, numer2, denom2) => {
7+
const numerator = numer1 * denom2 + numer2 * denom1;
8+
const denominator = denom1 * denom2;
9+
const greatestCommonDivisor = getGreatestCommonDivisor(numerator, denominator);
10+
11+
return [numerator / greatestCommonDivisor, denominator / greatestCommonDivisor];
12+
};

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,4 @@
296296
| 23.11.25. | `Level 0` | [특별한 이차원 배열 2](https://school.programmers.co.kr/learn/courses/30/lessons/181831) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181831.js) |
297297
| 23.11.26. | `Level 0` | [삼각형의 완성조건 1](https://school.programmers.co.kr/learn/courses/30/lessons/120889) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120889.js) |
298298
| 23.11.27. | `Level 0` | [순서쌍의 개수](https://school.programmers.co.kr/learn/courses/30/lessons/120836) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120836.js) |
299+
| 23.11.28. | `Level 0` | [분수의 덧셈](https://school.programmers.co.kr/learn/courses/30/lessons/120808) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120808.js) |

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /