
分治法
子长
这个作者很懒,什么都没留下…
展开
-
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. For example, Given [3,2,1,5,6,4] and k = 2, return原创 2017-09-24 12:41:52 · 219 阅读 · 0 评论 -
240. Search a 2D Matrix II
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in原创 2017-09-27 00:51:22 · 214 阅读 · 0 评论 -
Maximum Subarray (9月11日)
Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous su转载 2017-09-11 21:05:42 · 203 阅读 · 0 评论 -
169. Majority Element (9月8日)
169. Majority Element169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array原创 2017-09-08 21:45:10 · 196 阅读 · 0 评论 -
241. Different Ways to Add Parentheses
241. Different Ways to Add ParenthesesGiven a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid opera原创 2017-09-12 15:43:41 · 179 阅读 · 0 评论 -
4. Median of Two Sorted Arrays
题目题目链接 There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1,原创 2017-12-21 13:59:29 · 162 阅读 · 0 评论