题库chevron_right解题模式chevron_right二分·搜索·答案·空间
schema可复用解题模式

二分·搜索·答案·空间模式

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

database197 道题tune19/101/77 难度梯度category6 个关联题型

模式摘要

先识别什么

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

解法节奏

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

高频失分点

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

识别信号

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

解题流程

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

常见失分点

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

推荐题单梯度

题库

二分·搜索·答案·空间模式题库

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

慢加载模式题库

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

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

当前展示 24 / 197 道题目

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

寻找两个正序数组的中位数

Find the median of two sorted arrays using binary search for efficient O(log(min(m, n))) time complexity.

困难
33

搜索旋转排序数组

Find the index of a target in a rotated sorted array using a careful binary search that handles pivot shifts.

中等
34

在排序数组中查找元素的第一个和最后一个位置

Locate the first and last index of a target in a sorted array using binary search for precise O(log n) performance.

中等
35

搜索插入位置

Find the correct index for a target value in a sorted array using binary search, or return the position where it should …

简单
69

x 的平方根

Solve the Sqrt(x) problem using binary search to find the integer square root of a number without built-in operators.

简单
74

搜索二维矩阵

Search a 2D matrix efficiently using binary search over its linearized index, ensuring correctness in row-major sorted a…

中等
81

搜索旋转排序数组 II

Determine if a target exists in a rotated sorted array that may contain duplicates using a binary search variation effic…

中等
153

寻找旋转排序数组中的最小值

Find the minimum element in a rotated sorted array using binary search to efficiently identify the point of rotation.

中等
154

寻找旋转排序数组中的最小值 II

Find the minimum in a rotated sorted array with possible duplicates using binary search.

困难
162

寻找峰值

Find Peak Element leverages binary search for efficiently locating a peak in an array, a problem commonly asked in techn…

中等
167

两数之和 II - 输入有序数组

Solve the Two Sum II problem efficiently using binary search over a valid answer space in a sorted array.

中等
209

长度最小的子数组

Find the minimal length of a subarray whose sum is greater than or equal to the target using efficient algorithms.

中等
240

搜索二维矩阵 II

Efficiently search for a target in a 2D matrix using binary search and matrix properties.

中等
275

H 指数 II

Compute a researcher's H-Index from a sorted citation array using binary search over the valid answer space efficiently.

中等
278

第一个错误的版本

Find the first bad version of a product using binary search, minimizing the number of API calls.

简单
287

寻找重复数

The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…

中等
315

计算右侧小于当前元素的个数

Solve the Count of Smaller Numbers After Self problem using binary search and optimized algorithms.

困难
327

区间和的个数

Count the number of subarray sums within a given inclusive range using optimized divide-and-conquer techniques efficient…

困难
352

将数据流变为多个不相交区间

The problem involves designing a class to summarize a data stream of non-negative integers as disjoint intervals using b…

困难
363

矩形区域不超过 K 的最大数值和

Solve the "Max Sum of Rectangle No Larger Than K" problem using binary search over the valid sum space to optimize space…

困难
367

有效的完全平方数

Determine if a given positive integer is a perfect square using a binary search approach over potential square roots eff…

简单
374

猜数字大小

Find the picked number efficiently using binary search while adjusting guesses based on higher or lower feedback in this…

简单
378

有序矩阵中第 K 小的元素

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

中等
400

第 N 位数字

Given n, efficiently find the nth digit in the infinite integer sequence using a binary search over valid positions.

中等

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

按题型继续深入

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

route

引导式练习路径

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

开始引导练习arrow_forward
LeetCode 二分·搜索·答案·空间模式题解:197题训练路线