题目:给定两个字符串X,Y,求二者最长的公共子串,例如X=[aaaba],Y=[abaa]。二者的最长公共子串为[aba],长度为3。子序列是不要求连续的,字串必须是连续的。思路:1、简单思想:遍历两个字符串X、Y,分别比较X的字串与Y的字串,求出最长的公共字串。#include #include ...
分类:
其他好文 时间:
2015-04-30 19:57:51
阅读次数:
125
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-30 15:36:25
阅读次数:
135
参照:v_JULY_v
最长公共子序列定义:
注意最长公共子串(Longest CommonSubstring)和最长公共子序列(LongestCommon Subsequence, LCS)的区别:子串(Substring)是串的一个连续的部分,子序列(Subsequence)则是从不改变序列的顺序,而从序列中去掉任意的元素而获得的新序列;更简略地说,前者(子串...
分类:
其他好文 时间:
2015-04-30 14:23:18
阅读次数:
146
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-04-30 06:19:30
阅读次数:
117
Longest Valid Parentheses
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid pa...
分类:
其他好文 时间:
2015-04-29 15:06:06
阅读次数:
126
problem:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given...
分类:
其他好文 时间:
2015-04-29 09:56:50
阅读次数:
116
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 longes...
分类:
其他好文 时间:
2015-04-29 01:54:46
阅读次数:
113
网址:https://leetcode.com/problems/longest-palindromic-substring/
题意:
找出最长回文字符串.
解法1:
自然是暴力枚举,把每一个元素从中间往左右遍历,如果是且是最长的存下字符串.
比如abccba.
定位元素是2->c.
找左1->b.不行
找右3->c.可以->找左右同时->找左右同时
找左右同时.不行
思路就是...
分类:
其他好文 时间:
2015-04-28 22:56:08
阅读次数:
218
problem:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Retur...
分类:
其他好文 时间:
2015-04-28 18:27:59
阅读次数:
104
30}">
${fn:substring(s.name, 0, 30)}...
${s.name}...
分类:
Web程序 时间:
2015-04-28 14:17:08
阅读次数:
106