목록우선순위큐 (32)
넘치게 채우기
https://leetcode.com/problems/trapping-rain-water-ii/description/leetcode - Trapping Rain Water II문제 유형: 우선순위 큐, bfs문제 난이도: Hard 문제Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. m x n의 정수 행렬 heightMap이 주어진다. 이는 2D의 높이 지도를 셀단위로 나타내는데, 비가 오고 난 뒤 물이 고이는 물의 총 양을 구하여라. 풀이처음에는 https://rivero..
https://www.acmicpc.net/problem/1766BOJ - 문제집문제 유형: 위상정렬, 우선순위 큐문제 난이도: Gold II시간 제한: 2초메모리 제한: 128MB 문제민오는 1번부터 N번까지 총 N개의 문제로 되어 있는 문제집을 풀려고 한다. 문제는 난이도 순서로 출제되어 있다. 즉 1번 문제가 가장 쉬운 문제이고 N번 문제가 가장 어려운 문제가 된다.어떤 문제부터 풀까 고민하면서 문제를 훑어보던 민오는, 몇몇 문제들 사이에는 '먼저 푸는 것이 좋은 문제'가 있다는 것을 알게 되었다. 예를 들어 1번 문제를 풀고 나면 4번 문제가 쉽게 풀린다거나 하는 식이다. 민오는 다음의 세 가지 조건에 따라 문제를 풀 순서를 정하기로 하였다.N개의 문제는 모두 풀어야 한다.먼저 푸는 것이 좋은 문..
https://leetcode.com/problems/find-score-of-an-array-after-marking-all-elements/description/?envType=daily-question&envId=2024-12-13leetcode - Find Score of an Array After Marking All Elements문제 유형: 우선순위 큐문제 난이도: Medium 문제You are given an array nums consisting of positive integers.Starting with score = 0, apply the following algorithm:Choose the smallest integer of the array that is not marked. ..
https://leetcode.com/problems/kth-largest-sum-in-a-binary-tree/description/?envType=daily-question&envId=2024-10-22leetcode - Kth Largest Sum in a Binary Tree문제 유형: BFS, 우선순위 큐문제 난이도: Medium 문제You are given the root of a binary tree and a positive integer k.The level sum in the tree is the sum of the values of the nodes that are on the same level.Return the kth largest level sum in the tree (not..
https://leetcode.com/problems/longest-happy-string/description/?envType=daily-question&envId=2024-10-16leetcode - Longest Happy String문제 유형: 우선순위 큐, 그리디문제 난이도: Medium 문제A string s is called happy if it satisfies the following conditions:s only contains the letters 'a', 'b', and 'c'.s does not contain any of "aaa", "bbb", or "ccc" as a substring.s contains at most a occurrences of the letter 'a'...
https://leetcode.com/problems/maximal-score-after-applying-k-operations/description/?envType=daily-question&envId=2024-10-14leetcode - Maximal Score After Applying K Operations문제 유형: 우선순위 큐, 그리디문제 난이도: Medium 문제You are given a 0-indexed integer array nums and an integer k. You have a starting score of 0.In one operation:choose an index i such that 0 increase your score by nums[i], andreplace num..
https://leetcode.com/problems/divide-intervals-into-minimum-number-of-groups/description/?envType=daily-question&envId=2024-10-12leetcode - Divide Intervals Into Minimum Numbers of Groups문제 유형: 우선순위 큐, 정렬문제 난이도: Medium 문제You are given a 2D integer array intervals where intervals[i] = [lefti, righti] represents the inclusive interval [lefti, righti].You have to divide the intervals into one or mo..
https://leetcode.com/problems/the-number-of-the-smallest-unoccupied-chair/description/?envType=daily-question&envId=2024-10-11leetcode - The Number of the Smallest Unoccupied Chair문제 유형: 정렬, 우선순위 큐문제 난이도: Medium 문제There is a party where n friends numbered from 0 to n - 1 are attending. There is an infinite number of chairs in this party that are numbered from 0 to infinity. When a friend arrives..
https://leetcode.com/problems/modify-graph-edge-weights/description/?envType=daily-question&envId=2024-08-30leetcode - Modift Graph Edge Weights문제 유형 : 우선순위 큐, 다익스트라, 최단거리문제 난이도 : Hard 문제You are given an undirected weighted connected graph containing n nodes labeled from 0 to n - 1, and an integer array edges where edges[i] = [ai, bi, wi] indicates that there is an edge between nodes ai and bi w..
https://leetcode.com/problems/path-with-maximum-probability/description/?envType=daily-question&envId=2024-08-27leetcode - Path with Maximum Probability문제 유형 : 최단거리, 다익스트라, bfs, 우선순위 큐, 그래프문제 난이도 : Medium 문제You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability of..