전체 글
-
[2023 현대모비스 알고리즘 경진대회 예선] 상담원 인원코딩 테스트/Level 3 2024. 11. 23. 10:16
https://school.programmers.co.kr/learn/courses/30/lessons/214288 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr꽤 빡구현 문제지만, 파이썬은 내장 라이브러리로 꽤 많은 부분을 해결할 수 있어서 어렵지 않다. deque, itertools, heapq 등을 모두 동원해야 풀 수 있는 문제.물론 itertools를 쓰는 것 보다 좀 더 효율적인 방법이 있지만.. 가독성 및 코딩 시간 단축을 위해 내장 라이브러리를... from collections import dequefrom itertools import productfrom heapq import he..
-
[PCCP 기출문제] 4번 / 수식 복원하기코딩 테스트/Level 3 2024. 11. 21. 22:58
https://school.programmers.co.kr/learn/courses/30/lessons/340210 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 빡 구현 문제...코드가 지저분 ㅠ,.ㅠ import stringfrom functools import reducedef solution(expressions): def convert(num, base_): q, r = divmod(num, base_) if q == 0: return string.digits[r] else: return convert(q, ba..
-
[2024 KAKAO WINTER INTERNSHIP] 산 모양 타일링코딩 테스트/Level 3 2024. 11. 21. 18:33
https://school.programmers.co.kr/learn/courses/30/lessons/258705 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(n, tops): dp = [0] * (2 * n + 1) dp[0], dp[1] = 1, 2 if tops[0] == 0 else 3 for i in range(2, 2 * n + 1): if i % 2 == 1 and tops[i // 2] == 1: dp[i] = (dp[i - 1] * 2 + dp[i - 2]) % 10_007 else: ..
-
[PCCP 기출문제] 2번 / 퍼즐 게임 챌린지코딩 테스트/Level 2 2024. 11. 14. 17:04
https://school.programmers.co.kr/learn/courses/30/lessons/340212 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr음 일단 무식하게 ...def solution(diffs, times, limit): level = 1 while True: play_time = 0 for i in range(len(diffs)): play_time += times[i] if diffs[i] 시간제한에 걸려버린다. 이분 검색을 해야...https://comdoc.tistory.com/entry/32-%EC%9D%B4%EC..
-
[PCCP 기출문제] 3번 / 충돌위험 찾기코딩 테스트/Level 2 2024. 11. 10. 11:03
https://school.programmers.co.kr/learn/courses/30/lessons/340211 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr from collections import Counterdef solution(points, routes): maps = {} for route in routes: time = 0 y, x = points[route[0] - 1] maps.setdefault((y, x), []).append(time) for i in range(1, len(route)): end..
-
[PCCE 기출문제] 10번 / 공원코딩 테스트/Level 1 2024. 11. 9. 20:55
https://school.programmers.co.kr/learn/courses/30/lessons/340198 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr[Python]최적화가 필요하지만, 일단 막코딩..def solution(mats, park): max_y, max_x = len(park), len(park[0]) successes = set() for y in range(max_y): for x in range(max_x): if park[y][x] != '-1': continue for mat ..
-
[PCCE 기출문제] 9번 / 지폐 접기코딩 테스트/Level 1 2024. 11. 9. 17:48
https://school.programmers.co.kr/learn/courses/30/lessons/340199 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(wallet, bill): wallet, bill = sorted(wallet), sorted(bill) answer = 0 while bill[0] > wallet[0] or bill[1] > wallet[1]: bill[1] = bill[1] // 2 bill = sorted(bill) answer += 1 return answer
-
[PCCP 기출문제] 1번 / 동영상 재생기코딩 테스트/Level 1 2024. 11. 9. 17:42
https://school.programmers.co.kr/learn/courses/30/lessons/340213 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krdef solution(video_len, pos, op_start, op_end, commands): def time2sec(time: str) -> int: """ 시간을 초로 바꾼다. """ t, s = time.split(':') return int(t) * 60 + int(s) def sec2time(sec: int) -> str: """ 초를 시간으로 바꾼다. """ ..