题库chevron_right解题模式chevron_right
schema可复用解题模式

堆模式

模式页更适合建立可迁移的解题框架。先抓识别信号,再反复练状态定义、更新规则和边界解释,能比零散刷题更快形成稳定手感。

database35 道题tune3/22/10 难度梯度category6 个关联题型

模式摘要

先识别什么

题目里常出现可以复用的状态更新节奏。

解法节奏

先口述状态和不变量,再解释每一步如何更新,最后用反例验证边界。

高频失分点

状态定义说不清,写出来也难以稳定维护。

识别信号

  • 题目里常出现可以复用的状态更新节奏。
  • 暴力枚举太慢,但结构上存在可维护的不变量。
  • 面试追问通常会盯住边界、状态变更和复杂度。

解题流程

  1. 1. 明确窗口/状态定义
  2. 2. 更新状态并维护约束
  3. 3. 用边界样例验证

常见失分点

  • 状态定义说不清,写出来也难以稳定维护。
  • 只会背模板,解释不了为什么这样更新。
  • 样例能过,但边界和复杂度追问容易崩。

推荐题单梯度

题库

堆模式题库

这里更适合先按关键词或难度找题,再按关联题型切入。题库会在容器内继续滚动时慢慢续载,避免模式页被长列表一下子拉穿。

慢加载模式题库

适合先建模式理解,再扩展到完整题单。

hourglass_bottom容器内滚动续载
search
tune难度
category题型聚焦

当前展示 24 / 35 道题目

每次续载 24 题
#题目难度
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 …

困难
373

查找和最小的 K 对数字

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

中等
451

根据字符出现频率排序

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

中等
855

考场就座

Simulate an exam room where each student chooses a seat maximizing distance to others, using design plus heap structures…

中等
882

细分图中的可到达节点

The Reachable Nodes In Subdivided Graph problem requires efficiently finding the reachable nodes using graph traversal a…

困难
912

排序数组

Sort an array using an optimal algorithm, focusing on time and space complexity considerations.

中等
1046

最后一块石头的重量

In the 'Last Stone Weight' problem, we smash the two heaviest stones until one remains, using heaps or sorting.

简单
1354

多次求和构造目标数组

This problem requires constructing a target array from an array of ones, using multiple sum operations and a priority qu…

困难
1514

概率最大的路径

Find the path with the highest success probability in a graph from a start node to an end node, using edge probabilities…

中等
1738

找出第 K 大的异或坐标值

Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…

中等
1801

积压订单中的订单总数

Determine the total number of unfulfilled buy and sell orders using heaps to simulate backlog processing efficiently in …

中等
1825

求出 MK 平均值

Find the MKAverage of a stream of integers using a queue-driven approach with efficient state management.

困难
1845

座位预约管理系统

Manage seat reservations efficiently using a design combining priority queue to always return the lowest available seat …

中等
1882

使用服务器处理任务

Assign tasks to servers efficiently using arrays and heaps, resolving ties by weight and index while tracking availabili…

中等
2034

股票价格波动

Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.

中等
2102

序列顺序查询

Track rankings of locations with names and scores, adding new locations and retrieving top-ranked ones efficiently.

困难
2231

按奇偶性交换后的最大数字

Maximize a number by swapping digits of the same parity using sorting and priority queue techniques efficiently.

简单
2336

无限集中的最小数字

Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…

中等
2349

设计数字容器系统

Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…

中等
2532

过桥的时间

Time to Cross a Bridge involves simulating worker movements using arrays and heaps to determine when the last worker cro…

困难
2558

从数量最多的堆取走礼物

Take Gifts From the Richest Pile uses a heap to simulate the process of taking gifts from the richest pile over a number…

简单
2642

设计可以求最短路径的图类

Implement a dynamic weighted directed graph with efficient shortest path queries and edge additions in real time.

困难
2662

前往目标的最小代价

Find the minimum cost path between two points, using special roads or direct moves in a 2D space.

中等

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

按题型继续深入

模式学会之后,最好回到具体题型里做迁移训练。这样更容易分清楚“模式本身”和“场景变化”分别在哪里。

route

引导式练习路径

AI 会按你的当前水平推荐题目,并持续记录练习进度。

开始引导练习arrow_forward
LeetCode 堆模式题解:35题训练路线