본문 바로가기

TiL10

[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.
[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.26 https://1chanhue1.tistory.com/55 [프로그래머스 kotlin] 프로세스문제 설명운영체제의 역할 중 하나는 컴퓨터 시스템의 자원을 효율적으로 관리하는 것입니다. 이 문제에서는 운영체제가 다음 규칙에 따라 프로세스를 관리할 경우 특정 프로세스가 몇 번째로1chanhue1.tistory.com 2024. 6. 26.
[TIL] 06.21 https://1chanhue1.tistory.com/52 [프로그래머스 kotlin] 할인 행사문제 풀이 코드 fun solution(want: Array, number: IntArray, discount: Array): Int { var answer: Int = 0 // 원하는 물품 수량을 Map으로 만듦 val wantMap = mutableMapOf() for (i in want.indices) { wantMap[want[i]] = number[i] } // 할인 기1chanhue1.tistory.comhttps://1chanhue1.tistory.com/51형태의 결과를 반환한다. 즉, 키와 키에 해당하는 요소들을 리스트로 묶은 맵을 반환한" data-og-host="1chanhue1.tisto.. 2024. 6. 21.