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 |
Tags
- 팀 분석
- 브라이틱스
- 혼공
- 삼성SDS
- 삼성SDS Brightics
- 노코드AI
- 추천시스템
- 삼성SDS Brigthics
- 포스코 아카데미
- Brightics를 이용한 분석
- 삼성 SDS
- 영상제작기
- 혼공머신러닝딥러닝
- Brigthics를 이용한 분석
- Brigthics
- Brightics
- 직원 이직률
- 혼공머신
- 데이터분석
- 모델링
- 캐글
- 데이터 분석
- Brightics Studio
- Brigthics Studio
- 브라이틱스 서포터즈
- 혼공학습단
- 포스코 청년
- 삼성 SDS Brigthics
- 직원 이직여부
- 개인 의료비 예측
Archives
- Today
- Total
데이터사이언스 기록기📚
[프로그래머스] Level 2_모음사전(완전탐색) 본문
📌문제 유형
완전탐색
📌문제
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
📌나의 문제풀이
- 중복순열 이용하여 단어 조합 만들기
- 단어 조합 정렬
- 중복제거하기 위해 set 이용
- 인덱스 추출 위해 in 사용
from itertools import product
def solution(word):
answer = 0
word_dict = ['','A','E','I','O','U']
# 경우의 수 이용, sort
find_word = list(map("".join, product(word_dict,repeat = 5)))
find_word = sorted(set(find_word))
if word in find_word:
return find_word.index(word)
📌다른 사람들의 문제풀이
1) 유사한 풀이 - 한 줄 코드
from itertools import product
solution = lambda word: sorted(["".join(c) for i in range(5) for c in product("AEIOU", repeat=i+1)]).index(word) + 1
2) 문자 하나씩 다 넣기
def solution(word):
answer = 0
alpha = ["A","E","I","O","U",""]
ans = []
for i in alpha:
for j in alpha:
for k in alpha:
for l in alpha:
for m in alpha:
w = i+j+k+l+m
if w not in ans: ans.append(w)
ans.sort()
answer = ans.index(word)
return answer
📌리뷰
- 완전탐색 : 수학적으로 생각하기
- 정렬에 대해 다시 생각하기
📌참조
- 순열, 조합, 중복순열, 중복조합
(Python) 순열, 조합, 중복순열, 중복조합 쉽게 구현하기
<!DOCTYPE html> (Python) 순열, 조합, 중복순열, 중복조합 구현하기 (Python) 순열, 조합 쉽게 만들기¶ 결론부터 말하자면, 라이브러리에서 불러온 함수와 직접 구현한 함수가 속도차이 10배정도를 보였
juhee-maeng.tistory.com
728x90
'Coding Test > 프로그래머스(Python)' 카테고리의 다른 글
[프로그래머스] Level 2_타겟넘버(BFS/DFS) (1) | 2022.10.03 |
---|---|
[프로그래머스] Level 2_피로도(완전탐색) (0) | 2022.10.02 |
[프로그래머스] Level 2_소수 찾기(완전탐색) (0) | 2022.09.28 |
[프로그래머스] Level 1_최소직사각형(완전탐색) (0) | 2022.09.28 |
[프로그래머스] Level 2_카펫(완전탐색) (0) | 2022.09.27 |
Comments