给定一颗数,然后任意的起点或者终点,找到最大的路径和。例如:Given the below binary tree, 1 / \ 2 3Return6.一看到是标hard的题目就觉得要吃力才能搞出来。果然,经过不懈奋斗,成功从Time Limited到AC。我看到这...
分类:
其他好文 时间:
2014-12-04 00:42:49
阅读次数:
245
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-12-03 23:15:35
阅读次数:
248
这是LeetCode上的一道题目,需要求二叉树中两点路径的最大和。原题是https://oj.leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.The p...
分类:
其他好文 时间:
2014-12-03 23:05:58
阅读次数:
226
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 #include using namespace s...
分类:
其他好文 时间:
2014-12-03 22:58:18
阅读次数:
179
题目链接:点击打开链接
裸LCS 注意输入可能有空格
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define maxn 1005
#define _ll __int64
#d...
分类:
其他好文 时间:
2014-12-03 21:25:31
阅读次数:
131
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2014-12-03 21:16:44
阅读次数:
172
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-12-03 21:13:00
阅读次数:
187
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-12-03 21:10:21
阅读次数:
166
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-12-03 21:00:33
阅读次数:
141
题目链接:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1046
有人说这题是NOIP难度?表示怀疑,蒟蒻认为此题难度略大于NOIP。。。。
这个题的序列长度nhttp://www.slyar.com/blog/longest-ordered-subsequence.html中有详细讲解。
由于题目题意要求,我们需要求出以每个数字开头...
分类:
编程语言 时间:
2014-12-03 19:25:46
阅读次数:
159