> 알고리즘 문제 풀이78 20/09 - 기능개발 def solution(progresses, speeds): answer = [] days = [0] * len(progresses) for x in range(len(progresses)): days[x] = (100 - progresses[x]) / speeds[x] if (100 - progresses[x]) % speeds[x] != 0: days[x] += 1 while len(days) >= 2: day = days.pop(0) completed = 1 if day >= days[0]: while len(days) >= 1 and day >= days[0]: days.pop(0) completed += 1 answer.append(completed) if len(days) == 1: answe.. 2020. 9. 21. 20/09 - 주식가격 from collections import deque def solution(prices): prices_dq = deque(prices) answer = [0]*len(prices) if len(prices_dq) == 2: return [1,0] for x in range(len(prices_dq)): current_price = prices_dq.popleft() for next_price in prices_dq: answer[x] += 1 if current_price > next_price: break return answer print(solution([1, 2, 3, 2, 3])) """ [4, 3, 1, 1, 0] """ """ prices = ABCD A를 pop한다 prices = BC.. 2020. 9. 20. 이전 1 ··· 17 18 19 20 다음