Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2014-12-26 20:14:20
阅读次数:
156
Substring
时间限制:1000 ms | 内存限制:65535 KB
难度:1
描述
You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substrin...
分类:
其他好文 时间:
2014-12-26 14:40:43
阅读次数:
236
/*
* copyleft@hustyangju
* 问题:longest common subsequece problem
* 思路:从底往上,利用动态规划,划分子问题,利用LCS子问题的长度变化,求得LCS
* 时间复杂度O(m*n)
* 空间复杂度O(m*n)
*/
#include
#include
using namespace std;
class lcs
{
p...
分类:
编程语言 时间:
2014-12-26 13:01:52
阅读次数:
468
找到最多含有两个不同字符的子串的最长长度。例如:eoeabc,最长的是eoe为3,其他都为2.思路:用p1,p2表示两种字符串的最后一个出现的下标位置。初始p1为0. p2为-1.start初始化为0,表示两种字符串的开头。只要遍历一次string就可以得到结果了。首先我们要确定p2的值,那么i要一...
分类:
其他好文 时间:
2014-12-25 21:47:44
阅读次数:
150
题目:(String)Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique...
分类:
其他好文 时间:
2014-12-25 06:34:06
阅读次数:
198
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2014-12-23 15:05:53
阅读次数:
174
Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there...
分类:
其他好文 时间:
2014-12-23 00:07:39
阅读次数:
142
Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there...
分类:
其他好文 时间:
2014-12-21 23:28:50
阅读次数:
224
Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.Show TagsSOLUTION 1:解法很直观。先找到最小长度,然后逐个字母遍历,...
分类:
其他好文 时间:
2014-12-21 20:35:48
阅读次数:
189
题目:
Write a function to find the longest common prefix string amongst an array of strings.
第一种解决方案:
public class Solution {
public String longestCommonPrefix(String[] strs) {
int st...
分类:
其他好文 时间:
2014-12-20 23:32:55
阅读次数:
341