分治
memcpy0
希望探索文理结合的自由之路。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode C++ 973. K Closest Points to Origin【Sort/Divide and Conquer/Heap】中等
We have a list of points on the plane. Find the K closest points to the origin (0, 0).(Here, the distance between two points on a plane is the Euclidean distance.)You may return the answer in any order. The answer is guaranteed to be unique (except for原创 2020-11-09 16:53:26 · 348 阅读 · 0 评论 -
LeetCode C++ 剑指 Offer 40. 最小的k个数【Sort/Heap/分治】简单
输入整数数组 arr ,找出其中最小的 k 个数。例如,输入4、5、1、6、2、7、3、8这8个数字,则最小的4个数字是1、2、3、4。示例 1:输入:arr = [3,2,1], k = 2输出:[1,2] 或者 [2,1]示例 2:输入:arr = [0,1,2,1], k = 1输出:[0]限制:0 <= k <= arr.length <= 100000 <= arr[i] <= 10000题意:不用说明。解法1 sort 排序clas原创 2020-11-06 21:06:52 · 347 阅读 · 0 评论 -
LeetCode C++ 395. Longest Substring with At Least K Repeating Characters【分治/递归/动态规划】中等
Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.Example 1:Input:s = "aaabb", k = 3Output:3The longest substring is "aaa", as 'a' is repeat原创 2020-11-03 18:25:26 · 417 阅读 · 0 评论 -
LeetCode C++ 215. Kth Largest Element in an Array【堆/分治】中等
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and k = 2Output: 5Example 2:Input: [3,2,3,1,2,4,5,5,6] and k = 4Output: 4No原创 2020-06-29 14:33:37 · 492 阅读 · 0 评论
分享