Substring时间限制:1000 ms | 内存限制:65535 KB难度:1描述You
are given a string input. You are to find the longest substring of input such
that the reversal of the ...
分类:
其他好文 时间:
2014-05-10 06:20:56
阅读次数:
257
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-10 00:24:49
阅读次数:
255
题目如下:
Parentheses Balance
You are given a string consisting of parentheses () and []. A string of this type is said to be correct:
(a)
if it is the empty string
(b)
if A and B are ...
分类:
其他好文 时间:
2014-05-09 20:57:46
阅读次数:
316
N-Queens IThen-queens puzzle is the problem of
placingnqueens on ann×nchessboard such that no two queens attack each
other.Given an integern, return a...
分类:
其他好文 时间:
2014-05-09 20:34:01
阅读次数:
335
Generate ParenthesesGiven n pairs of parentheses,
write a function to generate all combinations of well-formed parentheses.For
example, given n = 3, a...
分类:
其他好文 时间:
2014-05-09 20:09:32
阅读次数:
333
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-05-09 13:13:02
阅读次数:
283
Given an array S of n integers, are there
elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the
array which gives the sum of ...
分类:
其他好文 时间:
2014-05-09 10:27:29
阅读次数:
449
戳我去解题Given amxnmatrix, if an element is 0, set its
entire row and column to 0. Do it in
place.这题还是很简单的,就是有点坑,遍历矩阵的时候,每遇到0的时候,我们不能立即将所在行和列置0,否则,到最后矩阵所有...
分类:
其他好文 时间:
2014-05-09 08:51:57
阅读次数:
253
戳我去解题Write an efficient algorithm that searches for
a value in anmxnmatrix. This matrix has the following properties:Integers in
each row are sorted f...
分类:
其他好文 时间:
2014-05-09 08:27:24
阅读次数:
241
The ? 1 ? 2 ? ... ? n = k problem
The problem
Given the following formula, one can set operators '+' or '-' instead of each '?', in order to obtain a given k
? 1 ? 2 ? ... ? n =...
分类:
其他好文 时间:
2014-05-09 06:10:40
阅读次数:
285