题目:给定两个串s1和s2,对s1串,我们可以将其分割成两部分,这两部分都不为空,而被分割成的两部分,又可以递归的进行分割,直到不能进行分割为止,也就是只有一个字符的时候,就不在分割了。问s2是否由s1的这种分割表示中,某步分割成的两部分交换得到的。这种交换可以在不同的分割点进行多次。
/* s1
|__________p____________| ...
分类:
其他好文 时间:
2014-06-05 11:09:06
阅读次数:
207
Problem Description:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transa...
分类:
其他好文 时间:
2014-06-05 09:33:52
阅读次数:
342
如果尿布臭了,就换掉它。
1.Duplicated Code 重复代码
Extract MethodPull Up MethodForm Template Method --》 Template Method 模式Substitute Algorithm --》 函数算法替代
2.Long Method 过长的函数
“间接层”所带来的全部利益--解释能力、共享能...
分类:
其他好文 时间:
2014-06-05 08:45:40
阅读次数:
291
【题目】
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous ...
分类:
其他好文 时间:
2014-06-05 08:28:43
阅读次数:
321
Once an algorithm is given for a problem and
decided to be correct, an important step is to determine how much in the way of resources,such as time or space, the algorithm will require.
...
分类:
其他好文 时间:
2014-06-05 02:14:29
阅读次数:
306
1.php -v 查看版本号
2.php -h 查看帮助
3.php -m 查看安装的模块
4.php -i 查看php信息(查看php.ini非常方便)
5.php --ini 显示配置文件名字
6.php -f 执行php文件...
分类:
Web程序 时间:
2014-06-04 23:49:13
阅读次数:
356
一条消息由A-Z的字母组成,将该消息按照上面的对应关系进行编码。给定一条已经经过编码的数字消息,求有多少种方式来对它进行解码。...
分类:
其他好文 时间:
2014-06-04 23:41:15
阅读次数:
442
题意:求一条线上最多几个点
思路:枚举一个点,然后求出过这个点的直线的斜率来求最大值
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 710;
const int INF = 1e7;
int arr[MAXN][2],n;
float brr[...
分类:
其他好文 时间:
2014-06-04 22:29:53
阅读次数:
333