Problem D
Predator II
Time limit: 2 seconds
Oh No!!! The predator has entered the room again. But this time it is a different kind of room.
The room is a square of size 1000...
分类:
其他好文 时间:
2014-07-22 23:03:13
阅读次数:
358
Problem Description 吉哥又想出了一个新的完美队形游戏!
假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ...
h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺...
分类:
其他好文 时间:
2014-05-10 19:42:07
阅读次数:
309
Link:http://oj.leetcode.com/problems/reverse-linked-list-ii/Reverse a linked
list from positionmton. Do it in-place and in one-pass.For example:Given1...
分类:
其他好文 时间:
2014-05-05 22:46:11
阅读次数:
411
本文出自:http://blog.csdn.net/svitter
题意:汉诺塔,多了一根柱子,问你寻找最快的移动次数。
dp [ n ] = dp [ n - j ] * 2 + pow( 2, j ) - 1;
就是把j个汉诺塔移到一根上,然后就是普通的汉诺塔问题,即2^n - 1次移动。
注意pow(2, j )可能超出long long int范围。写二的次方的时候也可用移...
分类:
其他好文 时间:
2014-05-03 00:14:10
阅读次数:
342
Instructionshereare not great.First shut down
ST2.Make sure you use absolute paths for symlink:e.g.$ curl -kL
http://xrl.us/pythonbrewinstall | bash$ ...
分类:
其他好文 时间:
2014-05-02 11:01:23
阅读次数:
382
题目: Given a string S, find the longest palindromic
substring in S. You may assume that the maximum length of S is 1000, and there
exists one unique lo...
分类:
其他好文 时间:
2014-05-01 20:07:13
阅读次数:
429
题目题意:给m个数字, q次询问, 询问b到e之间如果有重复数字就输出,
没有就输出OK思路:用f[i]数组 记录从i开始向后最近的有重复数字的 位置, 如 1 3 2 2, 则f[1] = 4;如果离a最近的重复数字的位置
都大于b, 就说明没有重复数字。f[]数组需要预处理,从后向前。 1 #i...
分类:
其他好文 时间:
2014-05-01 19:28:39
阅读次数:
286
git log 的用法,具体参考 git log --help,以下是个人在使用中遇见的问题,略作统计。
查看单个文件的修改差异(类似于查看单个文件的log,同时将每次log 的详细记录都显示出来):
--full-diff
Without this flag, git log -p ... shows commits that touch the specified paths,...
分类:
其他好文 时间:
2014-05-01 18:33:15
阅读次数:
324
原题链接: http://oj.leetcode.com/problems/unique-binary-search-trees/
这道题要求可行的二叉查找树的数量,其实二叉查找树可以任意取根,只要满足中序遍历有序的要求就可以。从处理子问题的角度来看,选取一个结点为根,就把结点切成左右子树,以这个结点为根的可行二叉树数量就是左右子树可行二叉树数量的乘积,所以总的数量是将以所有结点为根的可行结果...
分类:
其他好文 时间:
2014-04-30 22:12:39
阅读次数:
244