출처 : 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/118666
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
알파벳 순서를 몰라서 틀림...세상에
너무 놀았다...다시 시작
더보기
먼저, 생각해야 할 부분
없음
풀이
def solution(survey, choices):
answer = ''
types = dict([[char, 0] for char in 'RTCFJMAN'])
for i in range(len(survey)):
type1 = survey[i][0]
type2 = survey[i][1]
choice = choices[i] - 4
if choice < 0:
types[type1] += choice * -1
else:
types[type2] += choice
types = list(types.items())
for i in range(0, 8, 2):
answer += types[i][0] if types[i][1] >= types[i+1][1] else types[i+1][0]
return answer
Github
GitHub - bh2980/Algorithm-Problem: 알고리즘 풀이 흔적들
알고리즘 풀이 흔적들. Contribute to bh2980/Algorithm-Problem development by creating an account on GitHub.
github.com
'알고리즘 > Python' 카테고리의 다른 글
[python] 프로그래머스 - 멀리 뛰기 (1) | 2023.03.09 |
---|---|
[python] 프로그래머스 - 개인정보 수집 유효기간 (0) | 2023.03.09 |
[python] 프로그래머스 - 최솟값 만들기 (0) | 2022.07.17 |
[python] 프로그래머스 - 숫자 블록 (0) | 2022.07.15 |
[python] 프로그래머스 - 3 x n 타일링 (0) | 2022.07.14 |