84题和85五题 基本是一样的,先说84题 84 柱状图中最大的矩形( Largest Rectangle in Histogram) 思路很简单,通过循环,分别判断第 i 个柱子能够延展的长度len,最后把len heights[i] 就是延展开的面积,最后做比对,得出最大。 这个方法效率不是很高 ...
分类:
其他好文 时间:
2019-09-23 22:29:39
阅读次数:
91
①中文题目 在一个给定的数组nums中,总是存在一个最大元素 。 查找数组中的最大元素是否至少是数组中每个其他数字的两倍。 如果是,则返回最大元素的索引,否则返回-1。 示例 1: 输入: nums = [3, 6, 1, 0]输出: 1解释: 6是最大的整数, 对于数组中的其他整数,6大于数组中其 ...
分类:
其他好文 时间:
2019-09-16 10:29:02
阅读次数:
90
Given a 2D binary matrix filled with 0's and 1's,find the largest square containing only 1's and return its area. Input: 1 0 1 0 01 0 1 1 11 1 1 1 11 ...
分类:
其他好文 时间:
2019-09-11 20:11:23
阅读次数:
106
原题链接在这里:https://leetcode.com/problems/largest-sum-of-averages/ 题目: We partition a row of numbers A into at most K adjacent (non-empty) groups, then ou ...
分类:
其他好文 时间:
2019-09-03 13:29:25
阅读次数:
87
A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Ea ...
分类:
其他好文 时间:
2019-08-27 18:51:33
阅读次数:
89
/** * 给出n个数字,代表直方图的条高,直方图每一条的宽度为1,请计算直方图中最大矩形的面积 * * 上图是每条宽度为1, 高度 =[2,1,5,6,2,3].的直方图 * * 图中的阴影部分是该直方图中面积最大的矩形,面积为10个单位 * 例如: * 给出的高度 =[2,1,5,6,2,3],... ...
分类:
其他好文 时间:
2019-08-20 11:03:24
阅读次数:
73
【题目链接】 https://loj.ac/problem/10050 【题意】 给出n个数,其中取出两个数来,让其异或值最大。 【题解】 经典的01字典树问题。 首先需要把01字典树建出来。 然后对于每一个串都跑一遍。如果存在当前位 不同的 节点,就往那里跑,否则顺着跑。 一切尽在代码中。 【代码 ...
分类:
其他好文 时间:
2019-08-16 09:15:28
阅读次数:
88
(链接点这儿) 题目: The GCD of two positive integers is the largest integer that divides both the integers without any remainder. The LCM of two positive inte ...
分类:
其他好文 时间:
2019-08-10 20:59:27
阅读次数:
85
就是用快排那种划分,每次确定一个最终元素的位置,如果该位置是要找的数,则返回 ...
分类:
其他好文 时间:
2019-08-08 21:29:48
阅读次数:
106
problem 976. Largest Perimeter Triangle solution: 参考 1. Leetcode_easy_976. Largest Perimeter Triangle; 完 ...
分类:
其他好文 时间:
2019-08-07 19:33:51
阅读次数:
86