-
[프로그래머스] 더 맵게 - python코딩테스트 2024. 12. 31. 01:05
https://school.programmers.co.kr/learn/courses/30/lessons/42626
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr

import heapq def solution(scoville, K): answer = 0 heapq.heapify(scoville) while scoville: if scoville[0] >= K: return answer if len(scoville) < 2: return -1 first_min = heapq.heappop(scoville) sec_min = heapq.heappop(scoville) heapq.heappush(scoville, first_min + (sec_min*2)) answer += 1'코딩테스트' 카테고리의 다른 글
[프로그래머스] 입국심사 -python (0) 2025.01.08 [프로그래머스] 디스크 컨트롤러 - python (0) 2024.12.31 [프로그래머스] N으로 표현 (0) 2024.12.31 [프로그래머스] 정수 삼각형- python (0) 2024.12.15 [BAEKJOON] 이친수 - python (1) 2024.06.16