Skip to content

[Algorithm] 모음 사전 #201

Description

@hwangJi-dev

💬 문제

https://school.programmers.co.kr/learn/courses/30/lessons/84512


💬 Idea

  • DFS로 순차 탐색을 진행하며 모음 사전의 순번을 dict에 저장한다.

💬 풀이

import Foundation
varwordDict:[String:Int]=[:]varcount=0func solution(word:String)->Int{dfs(words:[])returnwordDict[word]!
}func dfs(words:[String]){wordDict[words.joined()]= count
if words.count ==5{return}else{foriin["A","E","I","O","U"]{
count +=1dfs(words: words +[i])}}}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions