public class Solution { public int maxArea(int[] height) { if (height == null || height.length < 2) { return 0; } ...
分类:
其他好文 时间:
2015-05-19 08:51:27
阅读次数:
125
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function shou....
分类:
编程语言 时间:
2015-05-19 00:46:34
阅读次数:
334
网址:https://leetcode.com/problems/container-with-most-water/
题意:
找两条纵深线,然后利用x坐标来计算容器面积.
分析:
先找最远的两头,然后往中间收缩,
长变小了,高变长才能使面积可能更大.
所以就是找更长的...
解法:
如果height[left]
反之,同理.
代码:
https://github.com/L...
分类:
其他好文 时间:
2015-05-18 16:43:02
阅读次数:
115
Title:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transacti...
分类:
其他好文 时间:
2015-05-18 12:26:25
阅读次数:
114
1.先获取两段的垂线和x轴组成的容器可以容纳的水量tempSum,并使得maxSum=tempSum;
2.然后再去除两段较小的垂线段,组成新的容器,获得新的可容纳的水量tempSum,并更新maxSum
3.循环直至start==end...
分类:
其他好文 时间:
2015-05-18 10:54:03
阅读次数:
122
Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction...
分类:
其他好文 时间:
2015-05-17 09:26:59
阅读次数:
102
People attend college or university for a lot of different reasons. I believe that the three most common reasons are to prepare for a career, to have ...
分类:
其他好文 时间:
2015-05-16 18:20:11
阅读次数:
126
题意:
There is a array contain N(1
Every query will be:
1 x : ask longest substring which every number no less than x
2 y x : change the A[y] to x. there are at most change 10 times.
For each ask...
分类:
其他好文 时间:
2015-05-16 14:52:28
阅读次数:
121
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:
编程语言 时间:
2015-05-16 11:47:02
阅读次数:
107
Learn Foreign LanguagesKlaus MarquardtPROGRAMMERS NEED TO COMMUNiCATE. A lot.
There are periods in a programmer’s life when most communication seems to be with the computer—more precisely, with the pr...
分类:
其他好文 时间:
2015-05-16 09:05:30
阅读次数:
116