728x90
순열을 이용해서 풀었고, 시간 초과가 날 수 없다고 생각을 했고 시간 초과가 나지 않았다. product 를 이용한 풀이도 있는 것 같다.
from itertools import permutations
def solution(word):
answer = [ ]
temp = ['A','E','I','O','U']*5
n = list(word)
for i in range(1,6):
k = list(permutations(temp,i))
for j in range(0,len(k)):
answer.append("".join(k[j]))
answer= sorted(list(set(answer)))
return answer.index(word)+1728x90
'🟢 알고리즘 문제 풀이 > Programmers' 카테고리의 다른 글
| [파이썬] 프로그래머스 N으로 표현 (0) | 2023.03.03 |
|---|---|
| [파이썬] 프로그래머스 구명보트 (0) | 2023.03.02 |
| [파이썬] 프로그래머스 소수 찾기 (0) | 2023.02.28 |
| [파이썬] 프로그래머스 프린터 (0) | 2023.02.27 |
| [파이썬] 프로그래머스 위장 (0) | 2023.02.24 |