Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty straight forward. Could you devis...
分类:
其他好文 时间:
2014-07-18 22:33:04
阅读次数:
328
Implement strStr().
Returns a pointer to the first occurrence of needle in haystack, or null if
needle is not part of haystack.
解题思路:
strstr()函数隶属标准库string.h头文件,其内部的实现是O(n^2)的时间复...
分类:
其他好文 时间:
2014-07-18 21:25:18
阅读次数:
328
DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. Wi...
分类:
其他好文 时间:
2014-07-18 17:12:31
阅读次数:
252
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:
其他好文 时间:
2014-07-18 15:07:26
阅读次数:
223
Not very hard to figure out the solution: splitting the list into 2 halves; reverse the 2nd half and interleave the two halves.But it takes some time ...
分类:
其他好文 时间:
2014-07-18 14:35:09
阅读次数:
214
题意:
两组数字a和b 如果a[i]等于b[j] 则可将a[i]和b[j]前所有数字删掉 这种操作花费e体力 得到1元钱 或者一次删掉所有数字 这种操作花费等于曾经删除的所有数字个数 做完后得到所有钱 问 一共s体力 可以得到多少钱
思路:
dp+二分
由数据可知最多拿到300元钱 因此可以定义 dp[i][j]表示有i元钱时 b串删除到了j处时 a串删到的位置
状态转移为 dp[i][j] = lower_bound ( a[j] , dp[i-1][j-1] + 1 ) 意思...
分类:
其他好文 时间:
2014-07-18 13:27:50
阅读次数:
212
B. Suffix Structures
Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team.
At a competition the "Bizons" got the following problem: "You are given two distinct w...
分类:
其他好文 时间:
2014-07-18 11:15:25
阅读次数:
252
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:
其他好文 时间:
2014-07-18 09:37:55
阅读次数:
161
百度在线手写板代码-php自学网
#sx{color:#00C;text-decoration:underline;cursor:pointer;}
手写
var w = window,d = document,n = navigator,k = d.f.wd
if (w.attachEvent) {
w.attachEve...
分类:
其他好文 时间:
2014-07-17 19:02:52
阅读次数:
635
Introduction In the post, we will start to deploy two-tier Teamcenter env step by step. We will use the following two Teamcenter installation tools wh...
分类:
系统相关 时间:
2014-07-17 13:09:01
阅读次数:
1536