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 8ea5f1c

Browse files
solve: 배열 만들기 2
1 parent 071ddc9 commit 8ea5f1c

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

‎Level0/PRO181921.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Solution 1
2+
const checkNumFitTheRule = (num) => {
3+
for (let digit of [...String(num)]) {
4+
if (digit !== '0' && digit !== '5') {
5+
return false;
6+
}
7+
}
8+
9+
return true;
10+
};
11+
12+
const solution = (l, r) => {
13+
const numList = [];
14+
15+
for (let num = l; num <= r; num++) {
16+
if (checkNumFitTheRule(num)) {
17+
numList.push(num);
18+
}
19+
}
20+
21+
return numList.length === 0 ? [-1] : numList;
22+
};

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,4 @@
313313
| 23.12.26. | `Level 0` | [특별한 이차원 배열 1](https://school.programmers.co.kr/learn/courses/30/lessons/181833) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181833.js) |
314314
| 23.12.27. | `Level 0` | [컨트롤 제트](https://school.programmers.co.kr/learn/courses/30/lessons/120853) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO120853.js) |
315315
| 23.12.30. | `Level 0` | [문자열 여러 번 뒤집기](https://school.programmers.co.kr/learn/courses/30/lessons/181913) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181913.js) |
316+
| 23.12.31. | `Level 0` | [배열 만들기 2](https://school.programmers.co.kr/learn/courses/30/lessons/181921) | [JS](https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Level0/PRO181921.js) |

0 commit comments

Comments
(0)

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