题目链接:http://poj.org/problem?id=2533
Longest Ordered Subsequence
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 35929
Accepted: 15778
Description
A ...
分类:
其他好文 时间:
2015-03-01 18:33:22
阅读次数:
171
题意:已知:给出n个结点的树,定义:两结点间的权值为两点之间所有边相异或的值.求:树中的某两点间的最大权值.
思路:先说简单一点的题:有道CowXor,是一串线性序列,求某连续段异或的最大值,这题的思路是先求前i项序列相异或的值Si,所以x到y的连续异或就是Sx^Sy ,因为a^b = (a ^ c) ^ (b ^ c).
这题同样是这个思路把线性拓展到树上,先求任何点到某一定点的连续...
分类:
编程语言 时间:
2015-03-01 13:17:12
阅读次数:
160
[LeetCode] 005. Longest Palindromic Substring (Medium) (C++/Java/Python)...
分类:
编程语言 时间:
2015-02-28 00:18:42
阅读次数:
226
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()",
...
分类:
其他好文 时间:
2015-02-27 21:37:53
阅读次数:
138
最长公共子序列
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。
tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合...
分类:
其他好文 时间:
2015-02-27 17:09:36
阅读次数:
160
[LeetCode] 003. Longest Substring Without Repeating Characters (Medium) (C++/Java/Python)...
分类:
编程语言 时间:
2015-02-27 13:34:22
阅读次数:
207
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-02-26 21:32:39
阅读次数:
152
Time Limit:2000MS Memory Limit:65536KBDescriptionGiven a string consisting of brackets of two types find its longest substring that is a regular brack...
Write a function to find the longest common prefix string amongst an array of strings.思路分析:这题很简单,基本就是以第一个字符串为标准,同时扫描后面的字符串对应index 字符是否相同,找到最大的相同前缀。但是实现的时候还是要注意一些corner case,比如输入数组为空或者只包含一个字符串的情况。AC Co...
分类:
其他好文 时间:
2015-02-23 12:02:19
阅读次数:
145
用Dp的思想解决了这道题目,也就是所谓的暴力= =题意:给出一个集合,一个字符串,找出这个字符串的最长前缀,使得前缀可以划分为这个集合中的元素(集合中的元素可以不全部使用)。还不会Trie 树QAQSource Code:/*ID: wushuai2PROG: prefixLANG: C++*///...
分类:
其他好文 时间:
2015-02-21 14:14:36
阅读次数:
116