题目给一个由几个相连接的矩形组成的多边形,计算多边形包含的最大的矩形的面积。 要求的矩形的高一定是某一个用来组合的矩形的高;如果枚举每个矩形作为高的话,那样长就是这个矩形能向左向右继续延伸矩形的长度了。 所以这题本质也是用单调栈在O(n)计算出每个数作为最小数向左和向右能延伸的最长距离。 1 #in
分类:
其他好文 时间:
2016-02-28 21:12:02
阅读次数:
132
题目链接:https://leetcode.com/problems/kth-largest-element-in-an-array/
215. Kth Largest Element in an Array
My Submissions
Question
Total Accepted: 43442 Total
Submissions: 136063 D...
分类:
编程语言 时间:
2016-02-24 09:41:19
阅读次数:
279
题型:sort 大意:将给定的一系列数组成新的数,并保证这个数最大 做法1:(直观) 1.1 对于两个不含有公共前缀的字符串,直接大小比较即可 1.2 对于两个含有公共前缀的字符串strx stry,则需要比较strx+stry和stry+strx这两个新字符串的大小 例如:98 9820 983
分类:
其他好文 时间:
2016-02-23 18:44:20
阅读次数:
192
Largest Submatrix Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2018 Accepted Submission(s): 9
分类:
其他好文 时间:
2016-02-21 00:09:28
阅读次数:
362
Question: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2
分类:
其他好文 时间:
2016-02-20 21:38:16
阅读次数:
240
题意:给一组数,求他们连起来能连出来的最大的数。 解法:一开始想就排一下序连在一起就好啦……结果样例就跪了……然后研究了各种排序规则……最后……我是傻蛋【手动挥手 注意前导零什么的……真坑 代码: class Solution { public: static bool cmp(string& a,
分类:
其他好文 时间:
2016-02-18 13:46:36
阅读次数:
151
Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it. Not
分类:
其他好文 时间:
2016-02-14 14:07:34
阅读次数:
1576
原题链接在这里:https://leetcode.com/problems/largest-bst-subtree/ Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where la
分类:
其他好文 时间:
2016-02-13 06:47:46
阅读次数:
278
A typical recursion use: class Solution(object): max_size = 0 # return: isValid, minVal, maxVal, nodeCnt def go(self, root): if root.left is None and
分类:
其他好文 时间:
2016-02-12 15:09:18
阅读次数:
169
Flip Game Time Limit: 1000MS Memory Limit: 65536K Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of i
分类:
其他好文 时间:
2016-02-09 12:01:42
阅读次数:
284