LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。**********************************************************...
分类:
其他好文 时间:
2015-02-20 22:00:21
阅读次数:
245
Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is...
分类:
其他好文 时间:
2015-02-16 20:58:05
阅读次数:
180
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...
分类:
其他好文 时间:
2015-02-16 15:32:54
阅读次数:
133
题目:给定长度为n的整数数列 a0,a1,...,an?1a_0,a_1,...,a_{n-1}以及整数S,求出总和不小于S的连续自序列的长度最小值。如果不存在,则输出0样例:输入
n = 10
S = 15
a = {5 , 1,3 ,5 ,10,7,4,9,2,8}
输出
2 (5 ,10)思路:尺取法通常的是保留数组的一对下标(开始到结束),然后根据实际情况交替移动。我们假设从i开...
分类:
其他好文 时间:
2015-02-13 16:39:24
阅读次数:
235
题目链接:http://poj.org/problem?id=3061
题意:给定长度为n的数列整数,以及整数S,求出总和不少于S的连续子序列的长度的最小值。如果解不存在,则输出0。
尺取法:通常是指对数组保存一对下标(起点,终点),然后根据实际情况交替推进两个端点直到解决问题的方法,这个操作很像尺蠼虫故得名。
思路:所以可以先初始化起点s,终点g,再一步一步推进,直到sum>S,然后记录此...
分类:
其他好文 时间:
2015-02-12 09:19:26
阅读次数:
95
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...
分类:
其他好文 时间:
2015-02-11 23:09:04
阅读次数:
154
题目来源,待字闺中,原创@陈利人 ,欢迎大家继续关注微信公众账号“待字闺中”原题这个LIS问题,可不是Longest Increasing Subsequence,而是Largest Independent Set,含义例如以下:给定一棵二叉树,找到满足例如以下条件的最大节点集合:集合中的随意两个节...
分类:
其他好文 时间:
2015-02-10 20:07:30
阅读次数:
194
Common SubsequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 40210Accepted: 16188DescriptionA subsequence of a given sequence is the giv...
分类:
其他好文 时间:
2015-02-08 14:02:33
阅读次数:
168
在写题解之前给自己打一下广告哈~。。抱歉了,希望大家多多支持我在CSDN的视频课程,地址如下:http://edu.csdn.net/course/detail/209题目:Common SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissio...
分类:
其他好文 时间:
2015-02-06 18:51:11
阅读次数:
125