Skip to content

Commit abec0aa

Browse files
committed
이슈 #420에서 솔루션 추가
1 parent db12330 commit abec0aa

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Programmers/모음사전.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
++
2+
#include <string>
3+
#include <vector>
4+
5+
using namespace std;
6+
7+
int result = 0;
8+
int cnt = -1;
9+
string aeiou = "AEIOU";
10+
11+
void dfs(string target, string currentWord) {
12+
cnt++;
13+
14+
if (target == currentWord) {
15+
result = cnt;
16+
return;
17+
}
18+
19+
if (currentWord.length() >= 5) {
20+
return;
21+
}
22+
23+
for (int i = 0; i < 5; i++) {
24+
dfs(target, currentWord + aeiou[i]);
25+
}
26+
}
27+
28+
int solution(string word) {
29+
dfs(word, "");
30+
31+
return result;
32+
}

0 commit comments

Comments
 (0)