알고리즘/프로그래머스
[2022 KAKAO TECH INTERNSHIP] 성격 유형 검사
래울
2023. 11. 12. 17:47
https://school.programmers.co.kr/learn/courses/30/lessons/118666
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
그냥 조건에 맞게 각각 점수를 잘 더해서 출력해내면 된다.
from collections import defaultdict
from functools import reduce
def solution(survey, choices):
answer = ''
scoreMatrix = [0, 3, 2, 1, 0, 1, 2, 3]
characterType = 'RCJATFMN'
result = defaultdict(int)
for i in characterType:
result[i] = 0
for i in range(len(survey)):
c = choices[i]
t = survey[i][0] if c < 4 else survey[i][1]
result[t] += scoreMatrix[c]
answer = ''
for l, r in zip('RCJA', 'TFMN'):
answer += r if result[l] < result[r] else l
return answer