#include#includeusingnamespacestd;intmin(inta,intb){returna>b?b:a;}intmax(inta,intb){returna>b?a:b;}intmaxProduct(intA[],intn){if(n==0){return0;}if(n=...
分类:
其他好文 时间:
2014-09-27 23:27:10
阅读次数:
188
典型的LCT操作,但是维护的是一个序列最左边减最右边的最小值,所以要维护左边减右边的最小值del[0]和一个右边减左边的最小值del[1](因为rev标记swap的时候对应的值也要交换)。维护的时候del[0]可能是来自于左右儿子的del[0],也有可能是来自于左儿子的最小值减去右儿子及当前节点的值...
分类:
其他好文 时间:
2014-09-27 22:14:40
阅读次数:
303
1)地球人都知道采用标签: <meta?name="viewport"?content="width=device-width,height=device-height,inital-scale=1.0,maximum-????scale=1.0,user-scalable=no;">
<meta?name="apple-mobile-web-app-...
分类:
移动开发 时间:
2014-09-27 14:47:50
阅读次数:
249
在网页的中增加以上这句话,可以让网页的宽度自动适应手机屏幕的宽度。其中:width=device-width :表示宽度是设备屏幕的宽度initial-scale=1.0:表示初始的缩放比例minimum-scale=0.5:表示最小的缩放比例maximum-scale=2.0:表示最大的缩放比.....
分类:
移动开发 时间:
2014-09-27 12:27:19
阅读次数:
184
题目:Max Points on a lineGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.这道题需要稍微转变一下思路,用斜率来实现,试想找在同一条...
分类:
其他好文 时间:
2014-09-26 21:42:28
阅读次数:
147
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],
the contiguous subarray [2,3] has the larges...
分类:
其他好文 时间:
2014-09-26 15:03:38
阅读次数:
359
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],
the contiguous subarray [2,3] has the larges...
分类:
其他好文 时间:
2014-09-26 01:16:58
阅读次数:
271
网页自适应手机、电脑屏幕的设置方法 Insert title here 第一个meta标签表示: 强制让文档与设备的宽度保持1:1; 文档最大的宽度比列是1.0(initial-scale初始刻度值和maximum-scale最大刻度值); user-scala...
分类:
Web程序 时间:
2014-09-25 19:22:07
阅读次数:
186
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],the...
分类:
其他好文 时间:
2014-09-25 15:11:49
阅读次数:
209
LinkedIn 高频题 – Maximum Sum/ProductSubarrayMaximum Sum Subarray是leetcode原题,跟Gas Station的想法几乎一模一样。解答中用到的结论需要用数学简单地证明一下。123456789101112public int maxSubA...
分类:
其他好文 时间:
2014-09-25 13:16:18
阅读次数:
223