본문 바로가기
PROGRAMMERS 42583: 다리를 지나는 트럭 Link : programmers.co.kr/learn/courses/30/lessons/42583 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 def solution(bridge_length, weight, truck_weights): queue = [] times = 1 pres_weight = 0 while len(truck_weights) or len(queue): if len(truck_weights) > 0: if pres_weight + truck_weights[0] 2021. 1. 5.
PROGRAMMERS 42586: 기능개발 Link : programmers.co.kr/learn/courses/30/lessons/42586 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 def solution(progresses, speeds): answer = [] while len(progresses): for i in range(len(progresses)): progresses[i] += speeds[i] stack = [] for i in range(len(progresses)): if progresses[i] >= 100: stack.append(i) else: break if len(stack) != 0: stack.reverse() for i in sta.. 2021. 1. 5.
PROGRAMMERS 42584: 주식가격 Link : programmers.co.kr/learn/courses/30/lessons/42584 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 def solution(prices): stack = [0 for _ in range(len(prices) - 1)] for i in range(len(prices) - 1): for p in range(i + 1, len(prices) - 1): if prices[i] 2021. 1. 5.
PROGRAMMERS 42579: 베스트앨범 Link : programmers.co.kr/learn/courses/30/lessons/42579 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 def solution(genres, plays): answer = [] ranking_kind = dict() play = dict() for idx, key in enumerate(genres): if key not in play: play[key] = list() ranking_kind[key] = 0 ranking_kind[key] += plays[idx] play[key].append((plays[idx], idx)) for i in play: play[i].sort(ke.. 2021. 1. 5.
PROGRAMMERS 42578: 위장 Link : programmers.co.kr/learn/courses/30/lessons/42578 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 def solution(clothes): data = dict() for i in clothes: if i[1] not in data: data[i[1]] = 1 else: data[i[1]] += 1 total = 1 for i in data: total *= (data[i] + 1) return total - 1 cs FeedBack cjw.git@gmail.com 2021. 1. 5.