Skip to content

Commit 6c190df

Browse files
committed
[level 0] Title: 옹알이 (1), Time: 0.25 ms, Memory: 33.4 MB -BaekjoonHub
1 parent 25b1cc3 commit 6c190df

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

프로그래머스/0/120956. 옹알이 (1)/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 성능 요약
66

7-
메모리: 33.5 MB, 시간: 0.35 ms
7+
메모리: 33.4 MB, 시간: 0.25 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2024년 10월 21일 21:55:29
19+
2025년 09월 30일 23:52:59
2020

2121
### 문제 설명
2222

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
function solution(babbling) {
2-
let doable_words = ["aya", "ye", "woo", "ma"];
32
let answer = 0;
3+
const regex = /^(aya|ye|woo|ma)+$/;
4+
5+
babbling.forEach(word => {
6+
if (regex.test(word)) answer++;
7+
})
48

5-
babbling.forEach(babble => {
6-
doable_words.forEach(word => {
7-
babble = babble.replace(word, " ");
8-
});
9-
10-
if (babble.trim() === "") {
11-
answer++;
12-
}
13-
});
14-
159
return answer;
1610
}

0 commit comments

Comments
 (0)