내일배움캠프21 [TIL] 07.09 https://1chanhue1.tistory.com/66 [프로그래머스 kotlin] 다리를 지나는 트럭fun solution(bridge_length: Int, weight: Int, truck_weights: IntArray): Int { var answer = 0 val truckQueue: Queue = LinkedList() val bridge: Queue = LinkedList() // 초기 다리는 빈 공간으로 채웁니다. for (i in 0 until bridge_length) { bridge.1chanhue1.tistory.com 2024. 7. 9. [TIL] 07.08 https://1chanhue1.tistory.com/64 [프로그래머스 kotlin] 2개 이하로 다른 비트문제 해결 POINT 숫자가 짝수인 경우짝수를 이진법으로 변환했을때 마지막 비트는 무조건 0이다.따라서 마지막 비트를 0에서 1로 바꿔준 값이 답이기 때문에 숫자+1 값을 answer에 넣어준다.숫자가1chanhue1.tistory.com 2024. 7. 8. [TIL] 07.03 2024. 7. 3. [TIL] 07.01 https://1chanhue1.tistory.com/60오늘의 알고리즘 코드카타 문제 [프로그래머스 kotlin] 롤케이크 자르기시간 초과 발생 코드 fun solution(topping: IntArray): Int { var count=0 for(i in topping.indices){ val set1 = mutableSetOf() val set2 = mutableSetOf() for(j in 0.. i){ set1.add(topping[j]) } for(k in i+1 until topping.size){ set2.add(topping[k]) }1chanhue1.tistory.com 2024. 7. 1. 이전 1 2 3 4 5 6 다음