Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist ...
分类:
其他好文 时间:
2016-06-30 14:10:11
阅读次数:
225
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, ...
分类:
其他好文 时间:
2016-06-29 21:53:36
阅读次数:
119
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, ...
分类:
其他好文 时间:
2016-06-29 19:07:16
阅读次数:
157
从我花时间上看,我是纠结排序很久。注意一下Comparator的写法,以后会了就好~ 算法上讲,就是对envolope尺寸排序,然后对于排序后的每个信封,它可以装进的最多小信封数,是长宽都比它小的信封中装的进最多数目+1。和之前做的368. Largest Divisible Subset思路是一样 ...
分类:
其他好文 时间:
2016-06-29 06:39:21
阅读次数:
150
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or ...
分类:
其他好文 时间:
2016-06-28 23:29:21
阅读次数:
202
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, ...
分类:
其他好文 时间:
2016-06-28 23:22:05
阅读次数:
190
368. Largest Divisible Subset 368. Largest Divisible Subset Total Accepted: 864 Total Submissions: 2728 Difficulty: Medium Given a set of distinct pos ...
分类:
其他好文 时间:
2016-06-28 18:26:46
阅读次数:
368
题目链接:https://leetcode.com/problems/largest-divisible-subset/题目:
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: S...
分类:
其他好文 时间:
2016-06-28 11:04:54
阅读次数:
124
先把数组排序,然后每一个数的位置上最长的序列是这个数之前的位置最长序列+1。这样一遍走完就可以知道最长的序列是多少,但是除了最长序列还需要知道那个序列,所以另外一个记录由哪个位置来的。因为最后一个数字未必会构成最长序列,所以还需要找到一个最长序列的那个结尾,一个max, maxPos. 所以维持四个 ...
分类:
其他好文 时间:
2016-06-28 07:05:13
阅读次数:
546
题目描述: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = ...
分类:
其他好文 时间:
2016-06-28 02:01:55
阅读次数:
139