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

数组·driven模式

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

database54 道题tune44/10/0 难度梯度category1 个关联题型

模式摘要

先识别什么

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

解法节奏

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

高频失分点

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

识别信号

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

解题流程

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

常见失分点

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

推荐题单梯度

题库

数组·driven模式题库

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

慢加载模式题库

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

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

当前展示 24 / 54 道题目

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

插入区间

Given a sorted array of non-overlapping intervals, insert a new interval and merge any overlapping intervals.

中等
228

汇总区间

Summary Ranges involves converting a sorted array of unique integers into a minimal list of range strings.

简单
485

最大连续 1 的个数

Find the maximum sequence of consecutive 1s in a binary array using an efficient array-driven scanning approach.

简单
665

非递减数列

Check if an array can become non-decreasing by modifying at most one element using an array-driven solution strategy.

中等
674

最长连续递增序列

Find the length of the longest continuous increasing subsequence in an unsorted integer array using an array-driven solu…

简单
717

1 比特与 2 比特字符

Determine whether the last character in a binary array represents a one-bit character or a two-bit character.

简单
849

到最近的人的最大距离

Determine the seat placement that maximizes distance to the nearest person using a linear array scan strategy efficientl…

中等
896

单调数列

Determine if an integer array is entirely monotone increasing or decreasing using a clear array-driven approach.

简单
915

分割数组

Partition the array into two subarrays such that the left contains the smallest possible elements and the right contains…

中等
941

有效的山脉数组

The 'Valid Mountain Array' problem requires determining if an array meets the conditions of a valid mountain array using…

简单
1184

公交站间的距离

Compute the minimal distance between two bus stops on a circular route using an array-driven solution approach.

简单
1287

有序数组中出现次数超过25%的元素

Identify the integer occurring more than 25% in a sorted array using a precise array-driven search strategy for efficien…

简单
1299

将每个元素替换为右侧最大元素

Replace every element in an array with the greatest element on its right side, and replace the last element with -1.

简单
1313

解压缩编码列表

Decompress a run-length encoded list by expanding each pair into repeated values based on frequency.

简单
1375

二进制字符串前缀一致的次数

Count how many times a 1-indexed binary string becomes prefix-aligned as bits are flipped sequentially using an array-dr…

中等
1431

拥有最多糖果的孩子

Determine which kids, after receiving extra candies, will have the greatest number of candies in a group.

简单
1437

是否所有 1 都至少相隔 k 个元素

Check if all 1's in a binary array are at least k places away from each other.

简单
1450

在既定时间做作业的学生人数

Count the number of students doing homework at a given time using an array-driven solution approach.

简单
1470

重新排列数组

Shuffle the Array requires an efficient approach to rearrange elements using an array-driven solution strategy with two …

简单
1550

存在连续三个奇数的数组

Determine if an integer array contains three consecutive odd numbers using a direct array-driven solution strategy for f…

简单
1725

可以形成最大正方形的矩形数目

Determine how many rectangles can be trimmed to form the largest possible square using an array-driven solution strategy…

简单
1752

检查数组是否经排序和轮转得到

Determine if a given integer array is sorted in non-decreasing order and then rotated, handling duplicates correctly.

简单
1779

找到最近的有相同 X 或 Y 坐标的点

Find the nearest point with the same x or y coordinate using Manhattan distance. Return its index or -1 if none exists.

简单
1800

最大升序子数组和

Solve Maximum Ascending Subarray Sum by scanning once, extending rising runs, and resetting the running sum at each drop…

简单

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

按题型继续深入

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

route

引导式练习路径

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

开始引导练习arrow_forward
LeetCode 数组·driven模式题解:54题训练路线