일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
- level3
- bfs
- Lv. 3
- Lv. 2
- SQL 고득점 KIT
- Python
- 파이썬
- 브루트포스
- Lv. 0
- javascript
- 프로그래머스
- C언어
- level 3
- dfs
- 자바스크립트
- Lv. 1
- 다이나믹프로그래밍
- 너비 우선 탐색
- group by
- Dynamic Programming
- programmers
- Java
- 타입스크립트
- 스택
- DP
- 소프티어
- Stack
- 문자열
- softeer
- Typescript
- Today
- Total
목록heapq (3)
몸과 마음이 건전한 SW 개발자
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/42627 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr정답 코드import heapqdef solution(jobs): # 작업들을 요청 시간순으로 정렬 jobs.sort() # 현재 시각, 완료된 작업의 수, 총 대기 시간을 기록할 변수들 currentTime = 0 completedJobs = 0 total = 0 # 우선순위 큐를 사용하여 처리할 작업을 관리 hq = [] idx..
문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/142085 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 import heapq def solution(n, k, enemy): answer = 0 cntR = len(enemy) if cntR front: if front > n: break n -= heapq.heappop(q) heapq.heappush(q, nextV) else: if nextV > n: break else: n -= nextV if j == cntR - 1..
문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/42628 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 import heapq def solution(operations): maxHeap = [] minHeap = [] for operation in operations: oper, number = operation.split() number = int(number) if oper == "I": heapq.heappush(maxHeap, -number) heapq.heappush..