题库chevron_right分类chevron_right分治
call_split

分治

42 道题目
简单: 5中等: 24困难: 13

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

面试场景

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

常见误区

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

练习策略

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

推荐练习顺序

#题目难度
4

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

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

困难
23

合并 K 个升序链表

Merge k Sorted Lists requires efficiently combining multiple sorted linked lists into one using pointers and priority qu…

困难
53

最大子数组和

Maximum Subarray is a classic state transition dynamic programming problem about deciding whether to extend or restart a…

中等
105

从前序与中序遍历序列构造二叉树

Construct a binary tree using preorder and inorder traversal arrays, leveraging array scanning and hash table lookups.

中等
106

从中序与后序遍历序列构造二叉树

Reconstruct a binary tree from given inorder and postorder arrays using array scanning and hash lookup to optimize recur…

中等
108

将有序数组转换为二叉搜索树

Pick the middle element as root at each step so the sorted array becomes a height-balanced BST with valid ordering.

简单
109

有序链表转换二叉搜索树

Convert a sorted singly linked list into a height-balanced BST using pointer manipulation and divide-and-conquer recursi…

中等
148

排序链表

Sort List requires sorting a singly linked list efficiently using pointer manipulation and merge sort for optimal perfor…

中等
169

多数元素

Find the majority element in an array, where the element appears more than n/2 times, using efficient algorithms.

简单
190

颠倒二进制位

Reverse a 32-bit unsigned integer by manipulating bits efficiently using a divide and conquer approach with careful bit …

简单
191

位1的个数

Number of 1 Bits is a classic bit manipulation problem where clearing the lowest set bit gives the cleanest count.

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

困难
240

搜索二维矩阵 II

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

中等
315

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

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

困难
324

摆动排序 II

Rearrange an array in a way that every odd-indexed element is greater than its adjacent even-indexed elements.

中等
327

区间和的个数

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

困难
347

前 K 个高频元素

Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.

中等
372

超级次方

Compute large exponentiations efficiently using modular arithmetic and divide-and-conquer techniques for this Super Pow …

中等
395

至少有 K 个重复字符的最长子串

Find the length of the longest substring where every character appears at least k times using sliding window and divide-…

中等
427

建立四叉树

Construct a Quad-Tree from a binary matrix by recursively subdividing regions and tracking uniform states efficiently.

中等
493

翻转对

Count the number of reverse pairs in a given integer array using efficient algorithms like binary search and merge sort.

困难
558

四叉树交集

Compute the logical OR of two binary matrices represented as Quad-Trees using recursive tree traversal and state propaga…

中等
654

最大二叉树

Construct a maximum binary tree by recursively selecting the largest element and dividing the array into left and right …

中等
889

根据前序和后序遍历构造二叉树

Reconstruct a binary tree from preorder and postorder traversals using array scanning and hash lookup.

中等
912

排序数组

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

中等
918

环形子数组的最大和

Find the maximum sum of a circular subarray using state transition dynamic programming, optimizing for wraparound cases …

中等
932

漂亮数组

Beautiful Array builds a valid permutation by recursively separating odd and even positions so no middle-average triple …

中等
973

最接近原点的 K 个点

Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…

中等
1382

将二叉搜索树变平衡

This problem requires balancing a binary search tree using in-order traversal and state tracking techniques.

中等
1569

将子数组重新排序得到同一个二叉搜索树的方案数

Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.

困难
1649

通过指令创建有序数组

The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.

困难
1738

找出第 K 大的异或坐标值

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

中等
1763

最长的美好子字符串

Find the longest nice substring in a given string using the sliding window technique with running state updates.

简单
1982

从子集的和还原数组

Reconstruct an array from given subset sums using divide and conquer approach and leveraging array properties.

困难
1985

找出数组中的第 K 大整数

This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…

中等
2179

统计数组中好三元组数目

Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.

困难
2343

裁剪数字后查询第 K 小的数字

Solve the Query Kth Smallest Trimmed Number problem by efficiently trimming and sorting strings in an array to answer qu…

中等
2407

最长递增子序列 II

Determine the longest increasing subsequence in an array where consecutive elements differ by at most k using dynamic pr…

困难
2426

满足不等式的数对数目

Count pairs in two arrays satisfying a given inequality condition using binary search over the valid answer space.

困难
3165

不包含相邻元素的子序列的最大和

Compute the maximum sum of a subsequence where no two adjacent elements are selected after each array update efficiently…

困难
3537

填充特殊网格

Fill a Special Grid uses recursive divide-and-conquer to populate a 2^n x 2^n matrix with sequential integers uniquely i…

中等

关联高频模式

LeetCode 分治题型题解:42题训练路线