问题描述:LIS(Longest Increasing Subsequence)最长上升(不下降)子序列,有两种算法复杂度为O(n*logn)和O(n^2)。在上述算法中,若使用朴素的顺序查找在D1..Dlen查找,由于共有O(n)个元素需要计算,每次计算时的复杂度是O(n),则整个算法的时间复杂度...
分类:
其他好文 时间:
2015-08-13 21:57:56
阅读次数:
185
var?str?=?"0123456789";
alert(str.substring(0));------------"0123456789"
alert(str.substring(5));------------"56789"
alert(str.substring(10));-----------""
alert(str.substring(12));-----------"...
分类:
Web程序 时间:
2015-08-13 18:23:46
阅读次数:
157
[Leetcode 3, Medium] Longest Substring Without Repeating Characters
分类:
其他好文 时间:
2015-08-13 14:18:23
阅读次数:
98
select * from tablename where substring_index(field1,'_',-1)=‘abc'#表中field1的值结构为123_abc
分类:
数据库 时间:
2015-08-13 13:44:58
阅读次数:
143
这道题目使用的方法具有非常大的普遍性,实际上是两个指针。一个指针记录当前所记录的子串的开始,另一个是当前遍历的位置,如果产生了重复,那么需要进行修正,实际上是对子串进行收缩。从当前子串开始位置到重复位置,重置相应的字符为违被搜索状态。在收缩之前需要进行,最长子串长度的更新。 1 public cla...
分类:
其他好文 时间:
2015-08-12 23:02:08
阅读次数:
121
问题描述: 给定两个序列 X=, Y,求X和Y长度最长的公共子串。(子串中的字符要求连续) 这道题和最长公共子序列(Longest common subsequence)很像,也可以用动态规划定义。公式如下:这里c[i,j]表示以Xi,Yj结尾的最长公共子串的长度。程序实现:int longes.....
分类:
其他好文 时间:
2015-08-12 21:13:28
阅读次数:
142
问题定义: 给定一个长度为N的数组A,找出一个最长的单调递增子序列(不要求连续)。 这道题共3种解法。1. 动态规划 动态规划的核心是状态的定义和状态转移方程。定义lis(i),表示前i个数中以A[i]结尾的最长递增子序列的长度。可以得到以下的状态转移方程:d(i) = max(1, d(j)...
分类:
其他好文 时间:
2015-08-12 18:43:08
阅读次数:
109
String path= this.getServletContext().getRealPath("") +request.getRequestURI().substring(request.getContextPath().length());(request.getContextPath()是...
分类:
其他好文 时间:
2015-08-12 01:11:02
阅读次数:
88
问题描述You are given a string,s, and a list of words,words, that are all of the same length. Find all starting indices of substring(s) insthat is a conca...
分类:
其他好文 时间:
2015-08-11 21:05:31
阅读次数:
109
问题描述Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letter...
分类:
其他好文 时间:
2015-08-11 15:55:30
阅读次数:
88