Skip to content

모음사전 #420

@fkdl0048

Description

@fkdl0048
#include <string>
#include <vector>

using namespace std;

int result = 0;
int cnt = -1;
string aeiou = "AEIOU";

void dfs(string target, string currentWord) {
    cnt++;
    
    if (target == currentWord) {
        result = cnt;
        return;
    }
    
    if (currentWord.length() >= 5) {
        return;
    }
    
    for (int i = 0; i < 5; i++) {
        dfs(target, currentWord + aeiou[i]);
    }
}

int solution(string word) {
    dfs(word, "");
    
    return result;
}

Metadata

Metadata

Assignees

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions