반응형
다리를지나가는트럭
-
프로그래머스 - 다리를 지나는 트럭알고리즘 문제 풀이 2020. 8. 8. 20:37
/* * 2020-08-08 * https://programmers.co.kr/learn/courses/30/lessons/42583 */ class TruckPassingTheBridge { fun solution(bridge_length: Int, weight: Int, truck_weights: IntArray): Int { var passingList = ArrayList() var time = 0 val truckList = truck_weights.toMutableList() var truck = truckList.removeAt(0) do { time++ passingList = passingList.filter { truckPair -> truckPair.second < bridge_len..