다리를 지나는 트럭
-
Level2) 다리를 지나는 트럭PS/programmers 2020. 10. 11. 15:57
import java.util.*; public class Solution { public int solution(int bridge_length, int weight, int[] truck_weights) { int time = 0; Queue boarding = new LinkedList(); Queue waiting = new LinkedList(); for (int t : truck_weights) { waiting.offer(new Truck(t, bridge_length)); } int remain_weight = weight; while (!(waiting.isEmpty() && boarding.isEmpty())) { if (!waiting.isEmpty()) { int nowWeight ..