题库chevron_right分类chevron_right二分查找
search

二分查找

265 道题目
简单: 26中等: 135困难: 104

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

面试场景

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

常见误区

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

练习策略

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

推荐练习顺序

题库

二分查找 题库

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

慢加载专题题库

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

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 265 道题目

每次续载 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.

中等
222

完全二叉树的节点个数

Count Complete Tree Nodes efficiently by leveraging binary-tree traversal, exploiting completeness, and applying bit man…

简单
240

搜索二维矩阵 II

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

中等
268

丢失的数字

Find the missing number in an array containing distinct numbers in the range [0, n].

简单
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…

中等
300

最长递增子序列

Solve the Longest Increasing Subsequence problem using dynamic programming and binary search to efficiently find the sub…

中等
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…

困难
349

两个数组的交集

Find the intersection of two arrays while ensuring unique elements using efficient array scanning and hash lookups.

简单
350

两个数组的交集 II

Find the intersection of two arrays, accounting for multiple occurrences of the same number.

简单
352

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

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

困难

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

关联高频模式

LeetCode 二分查找题型题解:265题训练路线