题目链接:Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
这道题的要求是在字符串数组中找到最长公共前缀。
思路比较简单,就是两个字符串逐个比较,找最长公共子串。这里采用将每个字符串都与第一个字符串相比较,求最长子串。
时间...
分类:
其他好文 时间:
2015-01-29 21:13:30
阅读次数:
197
原题地址双指针法。右指针不断向右试探,当遇到重复字符时停下来,此时左指针开始向右收缩,直到去掉那个重复字符。代码: 1 int lengthOfLongestSubstring(string s) { 2 map record; 3 int maxLen = 0; 4...
分类:
其他好文 时间:
2015-01-29 19:20:25
阅读次数:
140
Wall
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 30701
Accepted: 10340
Description
Once upon a time there was a greedy King who ordered his chief Archite...
分类:
其他好文 时间:
2015-01-29 09:26:50
阅读次数:
112
昨天写到《使用多字节字符集的跨平台(PC、Android、IOS、WP)编码/解码方法》中提到服务端使用std::string处理字符串,std::string对多字节字符集支持并不是很完善,std::string中的函数没有对多字节字符集进行直接的支持。例如直接调用std::string的subs...
分类:
其他好文 时间:
2015-01-28 21:24:13
阅读次数:
145
Total Accepted: 1167
Total Submissions: 3961
Given a string, find the length of the longest substring T that contains at most 2 distinct characters.
For example,Given s = “eceba”,
T is...
分类:
其他好文 时间:
2015-01-28 06:15:59
阅读次数:
149
Longest Valid Parentheses.
分类:
其他好文 时间:
2015-01-28 00:43:26
阅读次数:
202
题目链接:Longest Palindromic Substring
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 ...
分类:
其他好文 时间:
2015-01-27 23:35:02
阅读次数:
144
题目链接:Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
分类:
其他好文 时间:
2015-01-27 23:33:44
阅读次数:
176
描述:
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
repeating letters for "abcabcbb" is "abc", which the length is ...
分类:
其他好文 时间:
2015-01-27 20:21:40
阅读次数:
149
描述:
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-01-27 20:21:30
阅读次数:
205