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-04-30 00:58:10
阅读次数:
104
题目:LeetCode 014 Longest Common Prefix题意:给出一组字符串求公共前缀思路:很多个字符串的公共前缀应该不会很高,所以直接暴力解决就好但是又有个特判,即当只有一个字符串的时候,直接返回即可。另外,一定要注意每次利用下标访问字符串的时候,一定要判断是否在有效范围内。代码...
分类:
其他好文 时间:
2015-04-29 21:33:28
阅读次数:
113
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