Stack

파이썬

다리를 지나는 트럭 (Python Queue)

def solution(bridge_length, weight, truck_weights): bridge_list = [] sum = 0 count = 0 while True: if count > 0 and sum == 0: break if len(bridge_list) > bridge_length - 1: sum -= bridge_list[0] bridge_list.pop(0) if len(truck_weights) != 0: if sum + truck_weights[0]

IntegerString
'Stack' 태그의 글 목록