divide and conquer
Vendredimatin
这个作者很懒,什么都没留下…
展开
-
Leetcode 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 each column are sorted in ascending from top to bottom. Exampl原创 2020-06-29 11:34:50 · 102 阅读 · 0 评论 -
leetcode 53. Maximum Subarray
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation:...原创 2019-05-20 12:15:50 · 107 阅读 · 0 评论 -
leetcode 169. Majority Element
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 is non-empty and the maj...原创 2019-05-12 21:27:12 · 118 阅读 · 0 评论 -
leetcode 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)). You may assume nums1 and num...原创 2019-07-13 14:38:01 · 184 阅读 · 0 评论