목록전체 글 (183)
on my way

https://school.programmers.co.kr/learn/courses/30/lessons/12946# 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 하노이의 탑 프로세스1. start의 N-1개의 원반을 보조 기둥으로 옮긴다 (aux)2. 가장 큰 원반을 end로 옮긴다.3. 보조의 N-1개의 원반을 end로 옮긴다.def move(n, start, end, aux, answer): if n==1: answer.append([start, end]) return move(n-1, start, aux, end, answer) # n-1개 원반을 보조로 이..

https://school.programmers.co.kr/learn/courses/30/lessons/42583 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr# 1트 (돌아가긴 하나 비효율)from collections import dequedef solution(bridge_length, weight, truck_weights): i, cnt, flag = 0, 0, True time, queue = deque(), deque() while True: cnt += 1 time = deque([t+1 for t in time]) if time an..

https://school.programmers.co.kr/learn/courses/30/lessons/42586import mathdef solution(progresses, speeds): days = [math.ceil((100-p)/s) for p, s in zip(progresses, speeds)] answer = [] cur, func = 0, 0 for i, d in enumerate(days): if cur 먼저 소요일을 구하고, 소요일 배열을 기준으로 같이 배포될 수 있을지를 순회한다.cur는 기준배포일, func은 기능 수를 카운트하는 변수기준 배포일보다 큰 값이 나오면 새 그룹이므로 그 전까지 answer에 기능의 수를 넣고 기준배포일과 기능수 초기..

https://www.acmicpc.net/problem/2164from collections import dequeimport sysqueue = deque(range(1, int(sys.stdin.readline())+1))while len(queue) > 1: queue.popleft() queue.rotate(-1)print(queue[0])

https://school.programmers.co.kr/learn/courses/30/lessons/42584def solution(prices): N = len(prices) answer = [0 for _ in range(N)] stack = [] for now, price in enumerate(prices): # 스택 인덱스 가격과 현재 가격 비교. # 마지막 가격이 현재가격보다 크면 가격 떨어진 것이므로 인덱스 꺼냄 while stack and prices[stack[-1]] > price: idx = stack.pop() answer[idx] = now - idx # 현재 인덱스 - ..

https://school.programmers.co.kr/learn/courses/30/lessons/76502 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr# 리팩토링 전def solution(s): result = 0 for _ in range(len(s)): s = s[1:] + s[0] stack = [] for c in s: if c in '({[': stack.append(c) else: if not stack: break if c==')' and s..