알고리즘 코드리뷰/파이썬 (3) 썸네일형 리스트형 5. 프로그래머스_더맵게 소스 : https://github.com/diqksrk/AlgorithmPrac/blob/master/programmers/programmers_scouvile.py GitHub - diqksrk/AlgorithmPrac Contribute to diqksrk/AlgorithmPrac development by creating an account on GitHub. github.com 1. import heapq as pq 2. pq.heapify(scoville) 3. lowestFoodScovile = pq.heappop(scoville) 4. pq.heappush(scoville, lowestFoodScovile + pq.heappop(scoville) * 2) 1. heapq? 힙은 특정한 규칙.. 3. 프로그래머스_다리를지나는트럭 코드 : https://github.com/diqksrk/AlgorithmPrac/blob/master/programmers/programmers_truck.py GitHub - diqksrk/AlgorithmPrac Contribute to diqksrk/AlgorithmPrac development by creating an account on GitHub. github.com 1. from collections import deque 2. bridge = deque(0 for _ in range(bridge_length)) 3. truck_weights.reverse() 4. total_weight -= bridge.popleft() 1. deque란 ? deque의 개념 보통 큐(queue)는 선.. 1. 백준_기능개발 import math def solution(progresses, speeds): answer = [] days = [] dayCount = 1 for i in range(len(progresses)): days.append(math.ceil((100 - progresses[i]) / speeds[i])) standardDay = days.pop(0) for day in days: if (standardDay >= day): dayCount+=1 else: answer.append(dayCount) standardDay = day dayCount=1 if (dayCount != 0): answer.append(dayCount) return answer 순서는 내가 생각했을때, 좀더 확실히 알았으면 좋겠다.. 이전 1 다음