题库chevron_right分类chevron_right堆(优先队列)
label

堆(优先队列)

169 道题目
简单: 15中等: 93困难: 61

堆(优先队列) 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

题库

堆(优先队列) 题库

先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。

慢加载专题题库

适合这类题很多的专题,先扫结构,再逐步深入。

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 169 道题目

每次续载 24 题
#题目难度
23

合并 K 个升序链表

Merge k Sorted Lists requires efficiently combining multiple sorted linked lists into one using pointers and priority qu…

困难
215

数组中的第K个最大元素

Find the kth largest element in an unsorted array using optimal approaches like Quickselect or heaps.

中等
218

天际线问题

The Skyline Problem requires calculating a city's silhouette using array manipulation and divide-and-conquer techniques …

困难
239

滑动窗口最大值

Solve the "Sliding Window Maximum" problem using efficient techniques like the sliding window, deque, and priority queue…

困难
264

丑数 II

Find the nth ugly number, where ugly numbers have prime factors limited to 2, 3, and 5.

中等
295

数据流的中位数

Implement a MedianFinder class that supports adding numbers and finding the median from a data stream.

困难
347

前 K 个高频元素

Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.

中等
355

设计推特

Design Twitter requires implementing post, follow, unfollow, and news feed retrieval using linked-list pointer manipulat…

中等
373

查找和最小的 K 对数字

Find K Pairs with Smallest Sums combines arrays and heap usage to select the smallest sum pairs efficiently.

中等
378

有序矩阵中第 K 小的元素

Find the kth smallest element in a sorted n x n matrix using efficient binary search or heap strategies for optimized me…

中等
407

接雨水 II

Solve Trapping Rain Water II using breadth-first search and priority queues for efficient water trapping in a matrix.

困难
420

强密码检验器

The Strong Password Checker problem challenges you to optimize password strength while minimizing steps using greedy alg…

困难
451

根据字符出现频率排序

Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…

中等
480

滑动窗口中位数

Compute the median for each sliding window of size k in an array using efficient array scanning and hash lookup techniqu…

困难
502

IPO

Maximize total capital by selecting up to k projects, based on initial capital and project profits using a greedy strate…

困难
506

相对名次

Solve Relative Ranks by sorting scores with original indices, then writing medal labels or numeric places back in answer…

简单
621

任务调度器

Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…

中等
630

课程表 III

Solve the 'Course Schedule III' problem with a greedy approach involving course selection and validation of constraints.

困难
632

最小区间

Find the minimal range covering at least one number from each of k sorted lists using array scanning and hash lookup eff…

困难
658

找到 K 个最接近的元素

Identify the k integers closest to a target x in a sorted array using binary search and two-pointer strategies efficient…

中等
659

分割数组为连续子序列

Verify if it's possible to split a sorted array into consecutive subsequences of length 3 or more.

中等
675

为高尔夫比赛砍树

Determine the minimum steps to cut all trees in a forest matrix in ascending height order using BFS traversal and priori…

困难
692

前K个高频单词

Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…

中等
703

数据流中的第 K 大元素

Find the kth largest element in a dynamic stream using binary-tree traversal and efficient state tracking with a min-hea…

简单

swap_vert在题库框内继续向下滚动,也会自动续载

关联高频模式

LeetCode 堆(优先队列)题型题解:169题训练路线