问题描述最长公共子序列,英文缩写为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
WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:32808Accepted:11137DescriptionOnce upon a time there was a greedy King who ordered his chief...
分类:
其他好文 时间:
2015-11-10 12:23:42
阅读次数:
325
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
5、双向队列(deque)
一个线程安全的双向队列
class?deque(object):
????"""
????deque([iterable[,?maxlen]])?-->?deque?object
????
????Build?an?ordered?collection?with?optimized...
分类:
编程语言 时间:
2015-11-06 01:42:03
阅读次数:
489
题目链接: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
问题描述:给出一个序列a1,a2,a3,a4,a5,a6,a7….an,求它的一个子序列(设为s1,s2,…sn),使得这个子序列满足这样的性质,s1= 0; i--){ 8: int maxTemp = flag[i]; 9: for (int j = i+1; j flag[j] + 1 ...
分类:
编程语言 时间:
2015-11-04 22:43:01
阅读次数:
323
原题链接在这里:https://leetcode.com/problems/longest-increasing-subsequence/是一道DP问题,参考这篇帖子:http://blog.csdn.net/left_la/article/details/119510855,3,4,8,6,7根据...
分类:
其他好文 时间:
2015-11-04 14:24:07
阅读次数:
228