3-1.LIS(longest increas sequence)不多说,题目说了要($ O(n^2) $),我还能说什么呢? 相同题目:HDU 1087 super jumping !jumping!jumping! 而且不卡平方的做法 用dp[i]表示以 i 个数结尾的序列的LIS长度,初始化为 ...
分类:
编程语言 时间:
2016-04-18 10:12:54
阅读次数:
284
Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Example For "ABCD" and "EDCA", the LCS is "A" ...
分类:
其他好文 时间:
2016-04-18 08:43:52
阅读次数:
117
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2016-04-17 11:37:10
阅读次数:
158
题目链接: Ordered Subsequence Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description A numeric sequence of a ...
分类:
编程语言 时间:
2016-04-17 00:24:19
阅读次数:
305
刷leetcode,看到一个算法,给大神跪了。。。。看了半天才明白,下面谈谈理解 这道题最朴素的想法,就是两层遍历: 1、第一层遍历所有字符,表示以每一位置的字符打头的子串; 2、第二层,以某一位置字符开头,向后遍历,可以用map容器插入操作判断是否有重复字符,并计算长度; 3、这样做的话,实际上是 ...
分类:
其他好文 时间:
2016-04-15 21:54:33
阅读次数:
233
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa ...
分类:
其他好文 时间:
2016-04-14 16:03:45
阅读次数:
141
Write a function to find the longest common prefix string amongst an array of strings. ...
分类:
其他好文 时间:
2016-04-13 20:22:35
阅读次数:
229
题目 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lon ...
分类:
其他好文 时间:
2016-04-11 18:11:35
阅读次数:
155
题目:
Write a function to find the longest common prefix string amongst an array of strings.
题目大意:
写一个函数,求一个字符串数组中最长的公共前缀子串。
思路:
在做这道题之前先要了解一下什么叫做公共前缀子串。在英语中一个单词可以分为前缀、词根、后缀三部分,所谓前缀就是指在单词的开...
分类:
其他好文 时间:
2016-04-11 12:32:43
阅读次数:
128