题库chevron_right解题模式chevron_right数组·排序
schema可复用解题模式

数组·排序模式

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

database42 道题tune18/23/1 难度梯度category6 个关联题型

模式摘要

先识别什么

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

解法节奏

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

高频失分点

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

识别信号

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

解题流程

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

常见失分点

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

推荐题单梯度

题库

数组·排序模式题库

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

慢加载模式题库

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

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

当前展示 24 / 42 道题目

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

合并区间

Merge Intervals requires sorting an array of interval pairs and combining overlaps efficiently using sequential comparis…

中等
164

最大间距

Find the largest difference between successive elements in a sorted array efficiently using linear time techniques and b…

中等
274

H 指数

Determine a researcher's h-index by analyzing citations using array sorting and counting techniques efficiently and accu…

中等
414

第三大的数

Find the third distinct maximum number in an array using array traversal and sorting techniques, handling duplicates car…

简单
506

相对名次

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

简单
747

至少是其他数字两倍的最大数

Determine if the largest number in the array is at least twice as large as every other element, and return its index or …

简单
1051

高度检查器

Determine how many students are out of place in a line by comparing their heights to the sorted expected order efficient…

简单
1094

拼车

Determine if a car can handle multiple trips without exceeding its capacity using array sorting and event simulation tec…

中等
1200

最小绝对差

Find all pairs with the minimum absolute difference between two elements in an array, and return them in ascending order…

简单
1288

删除被覆盖区间

Remove all intervals fully covered by another using sorting and linear traversal, counting only distinct remaining inter…

中等
1329

将矩阵按对角线排序

Sort each diagonal of a matrix in ascending order, applying sorting and matrix traversal techniques.

中等
1333

餐厅过滤器

Filter restaurants by vegan-friendly status, price, and distance, and sort them by rating and ID.

中等
1424

对角线遍历 II

Traverse a jagged 2D array diagonally by grouping elements with equal row and column sums efficiently using sorting and …

中等
1464

数组中两元素的最大乘积

Find the maximum product of two elements in an array by carefully selecting indices and leveraging sorting for efficienc…

简单
1491

去掉最低工资和最高工资后的工资平均值

Calculate the average salary of employees, excluding the highest and lowest salaries, from an array of unique salaries.

简单
1502

判断能否形成等差数列

Determine if a given array can be rearranged into a valid arithmetic progression using sorting and consecutive differenc…

简单
1619

删除某些元素后的数组均值

Calculate the trimmed mean by removing the lowest and highest 5% of elements in an array using sorting for accuracy and …

简单
1637

两点之间不包含任何点的最宽垂直区域

Find the maximum width of a vertical area between points with no points inside using array sorting efficiently.

简单
1834

单线程 CPU

Simulate task processing with a single-threaded CPU by sorting and prioritizing tasks based on arrival and processing ti…

中等
1887

使数组元素相等的减少操作次数

Find the minimum number of operations to make all array elements equal by reducing the largest elements to the next smal…

中等
1913

两个数对之间的最大乘积差

Find the maximum product difference between two pairs in an integer array using sorting for optimal selection.

简单
2148

元素计数

Count elements in an array that have both strictly smaller and strictly greater numbers using array sorting efficiently.

简单
2164

对奇偶下标分别排序

Rearrange a 0-indexed array by sorting even and odd indices independently for predictable order and correctness.

简单
2191

将杂乱无章的数字排序

Sort numbers based on a custom mapping of their digits, leveraging array manipulation and sorting techniques.

中等

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

按题型继续深入

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

route

引导式练习路径

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

开始引导练习arrow_forward
LeetCode 数组·排序模式题解:42题训练路线