반응형 프로그래머스/1단계83 (Python/LV1) 달리기 경주 문제출처:https://school.programmers.co.kr/learn/courses/30/lessons/178871 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(players, callings): players_dict = {player:rank for rank, player in enumerate(players, start = 1)} for i in callings: change_rank = players_dict[i] - 1 # kai 이면 3을 저장 . reverse_dict = dict(map(reversed,pl.. 2023. 4. 8. (Python/LV1)공원 산책 문제 출처 : https://school.programmers.co.kr/learn/courses/30/lessons/172928 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr풀이:def solution(park, routes): answer = [] start = [] for i in range(len(park)): if 'S' in park[i]: start = [i, park[i].find('S')] break print(start) for route in routes: .. 2023. 4. 1. (Python/LV1)추억 점수 문제 출처: https://school.programmers.co.kr/learn/courses/30/lessons/176963 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이: def solution(name, yearning, photo): dic = {x:y for x,y in zip(name,yearning)} res = [] for i in range(len(photo)): result = 0 for z in photo[i]: if z in dic: result += dic[z] res.append(result) return res 2023. 4. 1. (Python/LV1)바탕화면 정리 문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/161990 풀이: def solution(wallpaper): n, m = len(wallpaper), len(wallpaper[0]) s_x, s_y, l_x, l_y = 51, 51, 0, 0 for i in range(n): for j in range(m): if wallpaper[i][j] == "#": s_x = min(s_x, i) s_y = min(s_y, j) l_x = max(l_x, i) l_y = max(l_y, j) return s_x,s_y,l_x + 1,l_y + 1 2023. 3. 2. (Python/LV1)대충만든자판 문제출처: https://school.programmers.co.kr/learn/courses/30/lessons/160586 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이: from collections import defaultdict def solution(keymap, targets): ans = [] value = defaultdict(int) for key in keymap: for k,v in enumerate(key): if not value[v]: value[v] = k + 1 else: value[v] = min(value[v], .. 2023. 2. 26. (Python/LV1)카드뭉치 문제 출처: https://school.programmers.co.kr/learn/courses/30/lessons/159994?language=python3 풀이: def solution(cards1, cards2, goal): for x in goal: print(x) if len(cards1)>0 and cards1[0] == x: cards1.pop(0) elif len(cards2) > 0 and cards2[0] == x: cards2.pop(0) else: return "x" return "yes" print(solution(["i", "drink", "water"], ["want", "to"], ["i", "want", "to", "drink", "water"])) # print(solut.. 2023. 2. 18. 이전 1 2 3 4 5 ··· 14 다음 반응형