Skip to content

Commit 7b80763

Browse files
authored
[20251102] PGM / LV2 / 모음사전 / 강신지
1 parent 4a1a7bd commit 7b80763

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
```java
2+
class Solution {
3+
static final char[] V = {'A','E','I','O','U'};
4+
static int answer = 0;
5+
static boolean equal = false;
6+
7+
void dfs(String cur, String target){
8+
if (equal) return;
9+
if (!cur.isEmpty()){
10+
answer++;
11+
12+
if (cur.equals(target)){
13+
equal = true;
14+
return;
15+
}
16+
}
17+
if (cur.length() == 5) return;
18+
for (char c : V){
19+
dfs(cur+c, target);
20+
}
21+
}
22+
23+
public int solution(String word) {
24+
dfs("", word);
25+
return answer;
26+
}
27+
}
28+
```

0 commit comments

Comments
 (0)