得到一个string序列的最长公共前缀。【思路】先求得最小string的长度,使得比较次数尽可能少。对于要返回的prefix的每一位,从第一个string中取一个字符,拿来和其他string同样位置的字符比较;如果不相同,则返回当前的prefix,否则添加到prefix后。【注意】读取第i个stri...
分类:
其他好文 时间:
2015-04-08 10:50:46
阅读次数:
81
1.Two Num
2.Add Two Numbers
3.Longest Substring Without Repeating Characters...
分类:
编程语言 时间:
2015-04-08 09:14:09
阅读次数:
200
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-08 00:54:17
阅读次数:
113
题意:给一字符串,求一个子串的长度,该子串满足所有字符都不重复。字符可能包含标点之类的,不仅仅是字母。按ASCII码算,就有2^8=128个。思路:从左到右扫每个字符,判断该字符距离上一次出现的距离是多少,若大于max,则更新max。若小于,则不更新。每扫到一个字符就需要更新他的出现位置了。这里边还...
分类:
其他好文 时间:
2015-04-07 23:16:50
阅读次数:
153
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-07 21:31:44
阅读次数:
120
【题目】
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring i...
分类:
其他好文 时间:
2015-04-06 20:21:52
阅读次数:
113
题目:leetcode
Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2]...
分类:
其他好文 时间:
2015-04-06 17:22:41
阅读次数:
160
Pre x goodness of a set string is length of longest common pre x*number of strings in the set. For
example the pre x goodness of the set f000,001,0011g is 6.You are given a set of binary strings. Fin...
分类:
其他好文 时间:
2015-04-06 01:07:22
阅读次数:
178
今天清明,再补一篇Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating l...
分类:
其他好文 时间:
2015-04-05 21:54:11
阅读次数:
134
https://leetcode.com/problems/longest-valid-parentheses/Given a string containing just the characters'('and')', find the length of the longest valid (...
分类:
其他好文 时间:
2015-04-05 21:38:33
阅读次数:
136