本周学习分治法,故特意挑选了相关习题巩固一下,并回顾一下分治法的思路 题目:Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is the kth large ...
分类:
其他好文 时间:
2017-03-05 14:20:43
阅读次数:
186
http://www.spoj.com/problems/MINSUB/en/ 题意:给出一个n*m的矩阵M,和一个面积k,要使得M的子矩阵M'的最小元素最大并且面积大于等于k,问子矩阵M'的最小元素最大能是多少,并且求出最大的面积。 思路:二分一个最小元素x,转化为判断矩阵M里面是否存在一个子矩阵 ...
分类:
其他好文 时间:
2017-03-04 18:39:51
阅读次数:
283
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 examp ...
分类:
其他好文 时间:
2017-03-01 23:27:35
阅读次数:
296
2017/3/1 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 ...
分类:
其他好文 时间:
2017-03-01 22:59:41
阅读次数:
244
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t ...
分类:
其他好文 时间:
2017-02-26 08:18:51
阅读次数:
185
You need to find the largest value in each row of a binary tree. Example: 这道题让我们找二叉树每行的最大的结点值,那么实际上最直接的方法就是用层序遍历,然后在每一层中找到最大值,加入结果res中即可,参见代码如下: 解法一: ...
分类:
其他好文 时间:
2017-02-20 00:57:18
阅读次数:
159
Problem DescriptionYou may not know this but it's a fact that Xinghai Square is Asia's largest city square. It is located in Dalian and, of course, a ...
分类:
其他好文 时间:
2017-02-03 20:48:18
阅读次数:
274
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following ma ...
分类:
其他好文 时间:
2017-02-03 10:50:18
阅读次数:
149
Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area o ...
分类:
编程语言 时间:
2017-01-29 15:26:52
阅读次数:
185
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, ...
分类:
其他好文 时间:
2017-01-29 13:14:15
阅读次数:
182