Skip to content

Commit df62639

Browse files
committed
[level 2] Title: 모음 사전, Time: 2.01 ms, Memory: 9.41 MB -BaekjoonHub
1 parent 2b8e983 commit df62639

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

프로그래머스/2/84512. 모음 사전/README.md

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

55
### 성능 요약
66

7-
메모리: 10.2 MB, 시간: 4.79 ms
7+
메모리: 9.41 MB, 시간: 2.01 ms
88

99
### 구분
1010

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

1717
### 제출 일자
1818

19-
2024년 10월 15일 11:13:53
19+
2025년 12월 27일 22:34:15
2020

2121
### 문제 설명
2222

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
vowels = ['A', 'E', 'I', 'O', 'U']
2-
idx = -1
3-
ans = 0
4-
51
def solution(word):
6-
def dfs(cnt, s):
7-
global ans, idx
8-
if cnt <= 5:
9-
idx += 1
10-
if s == word:
11-
ans = idx
12-
else:
2+
words = []
3+
vowel = ['A', 'E', 'I', 'O', 'U']
4+
5+
def dfs(current_word):
6+
if current_word != '':
7+
words.append(current_word)
8+
9+
if len(current_word) == 5:
1310
return
14-
for i in range(5):
15-
dfs(cnt + 1, s + vowels[i])
11+
12+
for v in vowel:
13+
dfs(current_word + v)
14+
15+
dfs('')
1616

17-
dfs(0, '')
18-
return ans
17+
return words.index(word) + 1

0 commit comments

Comments
 (0)