Skip to content

Commit 1b48663

Browse files
authored
Create 프로그래머스_모음사전.java
1 parent 11ea1d0 commit 1b48663

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
class Solution {
3+
static String [] word = {"A","E","I","O","U"};
4+
static int count = 0;
5+
static List<String> list = new ArrayList<>();
6+
7+
8+
public int solution(String word) {
9+
int answer = 0;
10+
dfs("");
11+
12+
return list.indexOf(word) +1;
13+
}
14+
15+
public void dfs(String str) {
16+
if (str.length() > 5) return;
17+
if (!str.isEmpty()) {
18+
list.add(str);
19+
}
20+
for (String w : word) {
21+
dfs(str+w);
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)