题目: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
经过了一个多月的时间,今天终于可以回到正轨了,继续开始刷CF。
题目大意:
给出一个只有括号的字符串,求最长“匹配”子串的长度和数量。
解题思路:
设置数组记录匹配括号段的开头。
下面是代码:
#include
#include
#include
#include
#include
#include
#include
#include
#incl...
分类:
其他好文 时间:
2015-01-14 14:17:58
阅读次数:
124
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
/**
* Definition for binary tree
*...
分类:
其他好文 时间:
2015-01-14 12:49:54
阅读次数:
131
Write a function to find the longest common prefix string amongst an array of strings.把输入strs当做二维数组,对每一列j, 检查strs[0...n-1][j]是否相同。 1 string longestCom...
分类:
其他好文 时间:
2015-01-13 19:38:59
阅读次数:
144
题目描述:Find a longest common subsequence of two strings.输入:First and second line of each input casecontain two strings of lowercase character a…z. There...
分类:
其他好文 时间:
2015-01-13 19:37:52
阅读次数:
180
求一个字符串的最长回文子串。回文子串分为两种,一种是aba型的,一种是abba型的,因此两种情况都有考虑到。用一个循环,对字符串中的每一个字符作为中心进行判断,并记录下每个循环后的最长子串。时间复杂度为O(n*n)
之前写了一个程序可以运行,但是在leetcode中运行超时了。下面的是修改别人的程序,很精简。
{CSDN:CODE:578916}...
分类:
其他好文 时间:
2015-01-13 17:53:08
阅读次数:
166
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2015-01-13 15:45:26
阅读次数:
126