Intuitively there must a O(n) solution.First I tried a bottom-up DP solution but it had a TLE:class Solution {public: int maxProduct(int A[], int n...
分类:
其他好文 时间:
2014-10-11 08:50:25
阅读次数:
141
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo...
分类:
移动开发 时间:
2014-10-11 05:30:54
阅读次数:
228
这是一个之前没发现的现象。
同样一段代码:
b=10000;
c=randn(1, b); %产生10000个正态分布的随机数
d=100;
[a,b]=hist(c,d); %平均分成100份
a=a/length(c); %把个数转换成频度
bar(a); ...
分类:
其他好文 时间:
2014-10-10 21:17:44
阅读次数:
230
状态栏的字体为黑色:UIStatusBarStyleDefault状态栏的字体为白色:UIStatusBarStyleLightContent一、在info.plist中,将View controller-based status bar appearance设为NO状态栏字体的颜色仅仅由以下的属性...
分类:
移动开发 时间:
2014-10-10 21:12:54
阅读次数:
187
先来看一个最简单的函数: void foo(int a)
{ cout *pFunc2)(7865); 此时的使用方式是正确的。 那么bar函数是static函数,它具有什么特点呢? void (*pFunc)(int) = &Foo::bar; pFunc(123); 我们发现,static函数和...
分类:
其他好文 时间:
2014-10-09 22:08:47
阅读次数:
204
1.insertInsert时,from子句既能够放在select子句后,也能够放在insert子句前,以下两句是等价的hive> FROM invites a INSERT OVERWRITE TABLE eventsSELECT a.bar, count(*) WHERE a.foo > 0 G...
分类:
其他好文 时间:
2014-10-09 21:51:37
阅读次数:
270
此题不难,可以用dfs来做,也可以用动态规划,但明显dfs性能不如dp。
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note:...
分类:
编程语言 时间:
2014-10-09 15:59:48
阅读次数:
163
归并排序可以有两种思路----top-down 和 bottom-up
top-down:
递归实现,将数组分成两半,分别处理;再合并。
伪代码如下:
split ( A[], l, r)
{
if ( r - l < 2) return;
m = (r + l) / 2;
split ( A, l, m); //split A[l…m-1]
split ( A, m, r); /...
分类:
其他好文 时间:
2014-10-09 02:51:37
阅读次数:
222
练习使用DPS的题,不知道有无别的做法,思路不复杂。形式是统计并且进行数字配对。 1 #include 2 3 int m,n,f,sub[25][4],note[25],ans[25]; 4 5 void ini(){ 6 int i,j,top,right,bottom,left;...
分类:
其他好文 时间:
2014-10-09 02:33:47
阅读次数:
196
AbsBottom 图像的下边缘与同一行中最大元素的下边缘对齐。 AbsMiddle 图像的中间与同一行中最大元素的中间对齐。 Baseline 图像的下边缘与第一行文本的下边缘对齐。 Bottom 图像的下边缘与第一行文本的下边缘对齐。 L...
分类:
其他好文 时间:
2014-10-08 17:33:35
阅读次数:
195