今天回顾WOJ1398,发现了这个当时没有理解透彻的算法。看了好久好久,现在终于想明白了。试着把它写下来,让自己更明白。最长递增子序列,Longest Increasing Subsequence 下面我们简记为 LIS。排序+LCS算法 以及 DP算法就忽略了,这两个太容易理解了。假设存在一个序列...
分类:
其他好文 时间:
2015-03-30 18:08:38
阅读次数:
127
题目:
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and w...
分类:
其他好文 时间:
2015-03-30 16:27:29
阅读次数:
114
求最长字串,要求字串中的所有字母不重复 思路 设定head和tail两个指针,tail每往前移动一格,便检查tail和head之间的所有字母是否与tail指向的字母重复,如果重复则将head指向重复的后一格例如:abcdefdc,当前head指向a,tail指向f,当tail指向下一个d的时候扫描h...
分类:
其他好文 时间:
2015-03-30 12:54:25
阅读次数:
114
1 package leetcode; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 class TrieNode{ 7 Boolean isWord;//true if path till ...
分类:
其他好文 时间:
2015-03-30 08:03:13
阅读次数:
252
题目:leetcode
Longest Substring Without Repeating Characters
Given
a string, find the length of the longest substring without repeating characters. For example, the longest substring without repea...
分类:
编程语言 时间:
2015-03-29 18:08:07
阅读次数:
152
1.题目要求Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating lett...
分类:
其他好文 时间:
2015-03-29 17:51:03
阅读次数:
123
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which ha...
分类:
其他好文 时间:
2015-03-29 13:41:53
阅读次数:
124
题意:给你一个序列,问你删除掉连续的一段,使得剩下的序列的最长上升字串最大,问你这个最大值。解题思路:分段dp, dp[i][0] ,dp[i][1] , 0表示前面没有切过,只能从前一个数的0状态得到,1状态表示前面已经切过了,能从前一个的1状态得到,也能从 在他前面的比他值小的dp[j][0]....
分类:
其他好文 时间:
2015-03-29 09:24:58
阅读次数:
128
1551: Longest Increasing Subsequence Again
Time Limit: 2 Sec Memory Limit: 256 MB
Submit: 29 Solved: 15
[Submit][Status][Web
Board]
Description
Give you a numeric sequence. If you can d...
分类:
其他好文 时间:
2015-03-28 23:18:21
阅读次数:
432
在这犯过错误,是js和java间的,特此记录:
java substring(start,end)表示从start,到end之间的字符串,包括start位置的字符但是不包括end位置的字符
js substr(start,length)表示从start位置开始取length个字符串
js substring(start,end)表示从start,到end之间的字符串,包括star...
分类:
编程语言 时间:
2015-03-28 21:48:06
阅读次数:
278