题目意思很简单啦,就是找回文使用string可以高速A过Source code:/*ID: wushuai2PROG: palsquareLANG: C++*///#pragma comment(linker, "/STACK:16777216") //for c++ Compiler#includ...
分类:
其他好文 时间:
2015-01-20 21:45:29
阅读次数:
128
题目: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 longest palindromic substring.
思路:题目要求的s的一个最长回...
分类:
编程语言 时间:
2015-01-15 23:54:08
阅读次数:
207
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-01-14 16:44:41
阅读次数:
109
Given a string S, find the longest palindromic substring in S.
Note:
This is Part II of the article: Longest
Palindromic Substring. Here, we describe an algorithm (Manacher’s algorithm) which...
分类:
其他好文 时间:
2015-01-14 15:40:50
阅读次数:
326
This interesting problem has been featured in the famous Greplin
programming challenge, and is asked quite often in the interviews. Why? Because this problem can be attacked in so many ways. There a...
分类:
其他好文 时间:
2015-01-14 15:40:39
阅读次数:
291
求一个字符串的最长回文子串。回文子串分为两种,一种是aba型的,一种是abba型的,因此两种情况都有考虑到。用一个循环,对字符串中的每一个字符作为中心进行判断,并记录下每个循环后的最长子串。时间复杂度为O(n*n)
之前写了一个程序可以运行,但是在leetcode中运行超时了。下面的是修改别人的程序,很精简。
{CSDN:CODE:578916}...
分类:
其他好文 时间:
2015-01-13 17:53:08
阅读次数:
166
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-palindromic-substring/Given a string S, find the ...
分类:
编程语言 时间:
2015-01-13 01:21:57
阅读次数:
285
题目链接:https://oj.leetcode.com/problems/longest-palindromic-substring/
这道题通常可以写出来的是2种做法。
1. 保持一个index从前往后扫,每次index的循环中,保持left和right的index向两边扫,但是有2种情况,aba和abba。left和right的扫描要扫2次
2. DP做法,2维矩阵
* 可以...
分类:
其他好文 时间:
2015-01-07 15:00:44
阅读次数:
128
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-01-06 23:07:00
阅读次数:
208
Longest Palindromic Substring
Question
Solution
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...
分类:
其他好文 时间:
2015-01-03 00:57:31
阅读次数:
272