프로그래머스 - 모음 사전


프로그래머스 - 모음 사전

12345678910111213141516from itertools import permutations def solution(word): vowel = ["A","E","I","O","U"]*5 dic = [] for i in range(1,6): for j in list(permutations(vowel,i)): dic.append("".join(j)) dic = sorted(list(set(dic))) return dic.index(word)+1 print(solution("AAAAE"))cs permutaitions로 모든 생성 가능한 조합을 생성,사전순으로 정렬 후 위치를 찾았는데 비효율적인것 같다....

프로그래머스 - 모음 사전 에 대한 요약내용입니다.

자세한 내용은 아래에 원문링크를 확인해주시기 바랍니다.



원문링크 : 프로그래머스 - 모음 사전