일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- Python Implementation
- Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- 프로그래머스
- DWG
- iterator
- 컴퓨터의 구조
- Python Code
- Generator
- Regular Expression
- Python
- 밴픽
- 운영체제
- 109. Convert Sorted List to Binary Search Tree
- data science
- 315. Count of Smaller Numbers After Self
- Decorator
- 43. Multiply Strings
- shiba
- Protocol
- Class
- attribute
- Substring with Concatenation of All Words
- t1
- 시바견
- 715. Range Module
- 파이썬
- concurrency
- LeetCode
- kaggle
Archives
- Today
- Total
목록다리를 지나는 트럭 (1)
Scribbling
프로그래머스: 다리를 지나는 트럭
from collections import deque def solution(bridge_length, weight, truck_weights): time, total_weight = 1, 0 q = deque() truck_weights = deque(truck_weights) while truck_weights: if not q: w = truck_weights.popleft() q.append([time, w]) total_weight += w else: if q[0][0] + bridge_length == time: total_weight -= q[0][1] q.popleft() w = truck_weights[0] if total_weight + w
Computer Science/Coding Test
2021. 10. 15. 00:21