본문 바로가기

내배캠4

[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] 06.27 https://1chanhue1.tistory.com/57 [프로그래머스 , kotlin] 피로도연결리스트를 이용한 풀이 ( 스택과 같은 기능으로)fun solution_ff(k: Int, dungeons: Array): Int { val stack = mutableListOf(Triple(k, 0, BooleanArray(dungeons.size))) var maxCount = 0 while (stack.isNotEmpty()) { val (currentK, count, vis1chanhue1.tistory.com 2024. 6. 27.
[TIL] 06. 18 https://1chanhue1.tistory.com/44 [프로그래머스] 연속 부분 수열 합의 개수문제 설명철호는 수열을 가지고 놀기 좋아합니다. 어느 날 철호는 어떤 자연수로 이루어진 원형 수열의 연속하는 부분 수열의 합으로 만들 수 있는 수가 모두 몇 가지인지 알아보고 싶어졌습니1chanhue1.tistory.comhttps://1chanhue1.tistory.com/45 이 경우 예시 ((((, [[{]] 이런 상황  ) 문제 해결 point1. 배열에서 열린 문자를 만난다면 스택" data-og-host="1chanhue1.tistory.com" data-og-source-url="https://1chanhue1.tistory.com/45" data-og-url="https://1chanhue1.. 2024. 6. 18.