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 a67b445

Browse files
solve: 합성수 찾기
1 parent b381a7a commit a67b445

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

‎Level0/PRO120846.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Solution 2
2+
const MIN_DIVISOR_COUNT_OF_COMPOSITE_NUM = 3;
3+
4+
const getDivisorList = (num) => {
5+
const divisorList = [];
6+
7+
for (let i = 1; i <= num; i++) {
8+
if (num % i === 0) {
9+
divisorList.push(i);
10+
}
11+
}
12+
13+
return divisorList;
14+
};
15+
16+
function solution(n) {
17+
return Array.from({ length: n }, (_, index) => index + 1).filter(
18+
(num) => getDivisorList(num).length >= MIN_DIVISOR_COUNT_OF_COMPOSITE_NUM
19+
).length;
20+
}

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,5 @@
286286
| 23.11.14. | `Level 0` | [수 조작하기 2](https://school.programmers.co.kr/learn/courses/30/lessons/181925) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181925.js) |
287287
| 23.11.15. | `Level 0` | [날짜 비교하기](https://school.programmers.co.kr/learn/courses/30/lessons/181838) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181838.js) |
288288
| 23.11.18. | `Level 0` | [l로 만들기](https://school.programmers.co.kr/learn/courses/30/lessons/181834) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181834.js) |
289-
| 23.11.19. | `Level 0` | [최빈값 구하기](https://school.programmers.co.kr/learn/courses/30/lessons/120812) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120812.js) |
289+
| 23.11.18. | `Level 0` | [최빈값 구하기](https://school.programmers.co.kr/learn/courses/30/lessons/120812) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120812.js) |
290+
| 23.11.19. | `Level 0` | [합성수 찾기](https://school.programmers.co.kr/learn/courses/30/lessons/120846) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120846.js) |

0 commit comments

Comments
(0)

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