题目描述作为一名情报局特工,Nova君(2号)有着特殊的传达情报的技巧。为了避免被窃取情报,每次传达时,他都会发出两句旁人看来意义不明话,实际上暗号已经暗含其中。解密的方法很简单,分别从两句话里删掉任意多个字母,使得两句话剩余的部分相同,通过一定的删除手法,可以让剩余的部分相同且长度最大,就得到了可...
分类:
其他好文 时间:
2015-11-15 13:23:35
阅读次数:
232
题目链接:http://poj.org/problem?id=3764题目大意是在树上求一条路径,使得xor和最大。由于是在树上,所以两个结点之间应有唯一路径。而xor(u,v)=xor(0,u)^xor(0,v)。所以如果预处理出0结点到所有结点的xor路径和,问题就转换成了求n个数中取出两个数,...
分类:
其他好文 时间:
2015-11-11 20:49:14
阅读次数:
283
Longest Common SubstringGiven two strings, find the longest common substring.Return the length of it.ExampleGiven A ="ABCD", B ="CBCE", return2.NoteTh...
分类:
其他好文 时间:
2015-11-11 06:29:29
阅读次数:
187
Longest Common SubsequenceGiven two strings, find the longest common subsequence (LCS).Your code should return the length ofLCS.ExampleFor"ABCD"and"ED...
分类:
其他好文 时间:
2015-11-11 06:28:55
阅读次数:
184
问题描述最长公共子序列,英文缩写为LCS(Longest Com#include const int MAX=1010;char x[MAX];char y[MAX];int DP[MAX][MAX];int b[MAX][MAX];using namespace std;int PRINT_LCS...
分类:
其他好文 时间:
2015-11-10 19:15:57
阅读次数:
225
题目大意:滑雪。给一个二维数组,找出最长的连续下降序列的长度。题目分析:定义dp(i,j)表示以a[i][j]结尾的最长连续下降序列的长度,则dp(i,j)=max(dp(i-1,j),dp(i+1,j),dp(i,j-1),dp(i,j+1)),重复这个DP过程滚动更新dp数组100次即可(我专门...
分类:
其他好文 时间:
2015-11-10 19:05:17
阅读次数:
239
class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ lenStr = len(s) ...
分类:
编程语言 时间:
2015-11-08 22:04:23
阅读次数:
299
原文地址:http://www.cnblogs.com/zhxshseu/p/4947609.html%20转载请注明出处:http://www.cnblogs.com/zhxshseu/p/4947609.html问题描述:Given a string S, find the longest pa...
分类:
其他好文 时间:
2015-11-08 17:47:32
阅读次数:
244
题目链接:https://leetcode.com/problems/longest-palindromic-substring/题目:Given a stringS, find the longest palindromic substring inS. You may assume that t...
分类:
其他好文 时间:
2015-11-05 21:57:51
阅读次数:
219
题目:
Given an unsorted array of integers, find the length of longest increasing subsequence.
For example, Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101], ...
分类:
其他好文 时间:
2015-11-05 18:55:22
阅读次数:
243