Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- dict
- 재귀
- DP
- MYSQL
- 수학
- python
- level3
- 힙
- level0
- 운영체제
- 딕셔너리
- BFS
- 코딩테스트
- 가상메모리
- N과M
- 구현
- 그리디
- 다익스트라
- programmers
- 스택
- BOJ
- 백준
- 프로그래머스
- 가상메모리 관리
- dfs
- 파이썬
- 브루트포스
- level1
- level2
- 다이나믹 프로그래밍
Archives
- Today
- Total
동캄의 코딩도장
프로그래머스 level2 [모음사전] 파이썬 본문
https://programmers.co.kr/learn/courses/30/lessons/84512
#프로그래머스 모음사전
def solution(word):
import sys
sys.setrecursionlimit(10**6)
vowels=['A','E','I','O','U']
global cnt
global answer
answer = 0
cnt=0
string=''
def dfs(w):
global cnt
global answer
cnt+=1
if w==word:
answer=cnt
if len(w)==5:
return
else:
for i in range(5):
dfs(w+vowels[i])
for i in range(5):
dfs(vowels[i])
return answer
dfs로 탐색했다.
'코테 > 프로그래머스' 카테고리의 다른 글
프로그래머스 level2 [예상 대진표] 파이썬 (0) | 2021.12.07 |
---|---|
프로그래머스 level2 [영어 끝말잇기] 파이썬 (0) | 2021.12.07 |
프로그래머스 level2 [주식가격] 파이썬 (0) | 2021.12.07 |
프로그래머스 level2 [괄호 회전하기] 파이썬 (0) | 2021.12.06 |
프로그래머스 level2 [짝지어 제거하기] 파이썬 (0) | 2021.12.06 |