카카오코테17 2022 KAKAO BLIND RECRUITMENT > 주차 요금 계산 - Python, ceil(올림), defaultdict 주소 코드 & 풀이 from collections import defaultdictimport mathdef solution(fees, records): in_times = defaultdict(int) # 입고 시간 total_times = defaultdict(int) # 주차 시간 last_time = (23 * 60) + 59 # 23:59 def set_time_to_minute(times): time, minute = map(int,times.split(":")) return time * 60 + minute for record in records: time, car_number, order = rec.. 2025. 3. 1. 2023 KAKAO BLIND RECRUITMENT > 택배 배달과 수거하기 - Pyton, 구현 https://school.programmers.co.kr/learn/courses/30/lessons/150369 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 코드 & 풀이 def solution(cap, n, deliveries, pickups): answer = 0 delivery_idx, pickup_idx = n - 1, n - 1 def check_endpoint(idx, task): while idx >= 0 and task[idx] == 0: idx -= 1 return idx def move(idx, ta.. 2024. 12. 9. 2024 KAKAO WINTER INTERNSHIP > 가장 많이 받은 선물 - Python, 구현 https://school.programmers.co.kr/learn/courses/30/lessons/258712?language=python3 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 코드 def solution(friends, gifts): size = len(friends) friends_idx = {name:i for i, name in enumerate(friends)} history = [[0] * size for _ in range(size)] gift_sub = [0] * size result = [0] * size for gift in gi.. 2024. 12. 8. 2021 KAKAO BLIND RECRUITMENT > 신규 아이디 추천 - Python, 정규표현식 https://school.programmers.co.kr/learn/courses/30/lessons/72410 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 코드 import redef solution(new_id): new_id = re.sub(r'[^a-z0-9_.-]', '', new_id.lower()) new_id = re.sub(r'\.{2,}', '.', new_id).strip('.') new_id = "aaa" if not new_id else new_id[:15].rstrip('.') return new_id.ljust(3, new_id[-1]) 정규표현식을.. 2024. 12. 7. 2018 KAKAO BLIND RECRUITMENT > 다트 게임 - Pyton, re, compile, findall, 정규식 https://school.programmers.co.kr/learn/courses/30/lessons/17682 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 코드def solution(dartResult): num = "" score = [] bonus = {"S":1, "D":2, "T":3} for round in dartResult: if round.isdigit(): num += round elif round in bonus: score.append(int(num) ** bonus[round].. 2024. 12. 6. 2019 카카오 개발자 겨울 인턴십 > 크레인 인형뽑기 게임 - Python, stack https://school.programmers.co.kr/learn/courses/30/lessons/64061 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 풀이 - 나의 생각board의 최상단에 위치한 인형을 찾아 그 값이 stack의 이전 값과 같으면 stack에 있는 값도 pop하고 인형의 개수(+2) 추가 아니라면 stack에 저장해주고 넘어갑니다. 2019년도 카카오 인턴십에 나온 문제라는데 현재보다는 난이도가 낮은 듯 합니다. 좀 더 빠르게 풀 수 있는 방법이 뭘까 하다가 최상단에 있는 인형을 미리 조사해서 뽑아다 쓰는 방법을 해봤습니다. 속도는 거의 2배 차이 나네요. 코드 def so.. 2024. 12. 4. 이전 1 2 3 다음