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
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
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 consecutive elements sequence is [1, 2, 3, 4]....
分类:
其他好文 时间:
2015-04-28 16:16:23
阅读次数:
143
[Java] LeetCode32 Longest Valid Parentheses...
分类:
编程语言 时间:
2015-04-28 11:56:33
阅读次数:
125
problem:
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 consecutive elements ...
分类:
其他好文 时间:
2015-04-28 09:38:52
阅读次数:
106
网址:https://leetcode.com/problems/longest-substring-without-repeating-characters/
题意:
求出最长子字符串且不含重复字符
分析:
题意比较简单
只需要注意字符串为空的特殊情况.
字符是char的0-255,不仅仅是26个小写字母.
解法:
一直统计长度,直到有字符被重复为止,再记录被重复的字符的下一位...
分类:
其他好文 时间:
2015-04-27 23:49:44
阅读次数:
126
题目: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 consecutive elements sequence ...
分类:
其他好文 时间:
2015-04-27 21:50:24
阅读次数:
142
题目:LeetCode 003 Longest Substring Without Repeating Characters题意:给一个字符串,找到一个没有重复字符的最长子串。样例:”bbbbb” 返回”b”的长度1;”abcabcbb”返回”abc”的长度3。思路:动态规划。dp[i]表示以第i个...
分类:
其他好文 时间:
2015-04-26 18:15:18
阅读次数:
117
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.
基本思路:回文字符串显然有个特征是沿...
分类:
其他好文 时间:
2015-04-26 16:51:58
阅读次数:
142