给定两个字符串,你需要从这两个字符串中找出最长的特殊序列。最长特殊序列定义如下:该序列为某字符串独有的最长子序列(即不能是其他字符串的子序列)。子序列可以通过删去字符串中的某些字符实现,但不能改变剩余字符的相对顺序。空序列为所有字符串的子序列,任何字符串为其自身的子序列。输入为两个字符串,输出最长特 ...
分类:
其他好文 时间:
2018-04-22 18:12:37
阅读次数:
125
给定一个字符串s,找到其中最长的回文子序列。可以假设s的最大长度为1000。 详见:https://leetcode.com/problems/longest-palindromic-subsequence/description/ C++: 参考:http://www.cnblogs.com/gr ...
分类:
其他好文 时间:
2018-04-22 17:18:26
阅读次数:
133
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159 Problem Description 给定序列的子序列是给定的序列,其中有一些元素(可能没有)被遗漏。 给定一个序列X = <x1,x2,...,xm>如果存在严格递增的序列<i1,i2,... ...
分类:
其他好文 时间:
2018-04-21 17:45:57
阅读次数:
153
[抄题]: Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Example 2: [暴力解法]: 时间分析 ...
分类:
编程语言 时间:
2018-04-21 17:41:00
阅读次数:
129
详见:https://leetcode.com/problems/arithmetic-slices-ii-subsequence/description/ C++: 参考:https://www.cnblogs.com/grandyang/p/6057934.html ...
分类:
其他好文 时间:
2018-04-21 13:31:43
阅读次数:
161
#include using namespace std; int main() { string s1,s2; while(cin>>s1>>s2){ int l1=s1.size(),l2=s2.size(); vector> dp(l1+1,vector(l2+1,0)); for(int i... ...
分类:
其他好文 时间:
2018-04-20 10:58:14
阅读次数:
104
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4632 题目大意:给你若干个字符串,回答每个字符串有多少个回文子序列(可以不连续的子串)。解题思路: 设dp[i][j]为[i,j]的回文子序列数,那么得到状态转移方程: dp[i][j]=(dp[i+1 ...
分类:
其他好文 时间:
2018-04-17 00:49:42
阅读次数:
192
We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra ...
分类:
其他好文 时间:
2018-04-15 20:57:27
阅读次数:
171
【题意概述】 找两个字符串的最长不公共子串。 【题目分析】 两个字符串的最长不公共子串就应该是其中一个字符串本身,那么判断两个字符串是否相等,如果相等,那么肯定没有公共子串,输出“-1”.否则就是两个字符串中长的最长的长度。 【AC】 ...
分类:
其他好文 时间:
2018-04-15 18:45:53
阅读次数:
151
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. 判断字符串中最长的回文子串,子串不一定要连续。 ...
分类:
其他好文 时间:
2018-04-06 16:02:40
阅读次数:
193