10000 [23-02-01] seungyeon.py by seungueonn · Pull Request #41 · da-in/algorithm-study · GitHub
[go: up one dir, main page]

Skip to content

[23-02-01] seungyeon.py #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create [힙] 더 맵게 seungyeon.py
  • Loading branch information
seungueonn committed Jan 31, 2023
commit 21facbe66a045338827db913c594b4cc795efb2e
13 changes: 13 additions & 0 deletions Programmers - 고득점 Kit/[힙] 더 맵게/seungyeon.py
Original file li 56DF ne number Diff line number Diff line change
@@ -0,0 +1,13 @@
import heapq
def solution(scoville,K):
answer = 0
heapq.heapify(scoville)

while(scoville[0]<K):
if len(scoville) == 1 and scoville[0] < K:
return -1
new = heapq.heappop(scoville) + heapq.heappop(scoville)*2
heapq.heappush(scoville,new)
answer+=1
return answer

0