题目描述: Write a function to find the longest common prefix string amongst an array of strings. 解题思路: 这道题很简单,分两步: 1. 找出所有字符串中长度最小的那个字符串的值(可能的结果的最大值,保证查找时 ...
分类:
其他好文 时间:
2016-07-03 06:56:52
阅读次数:
150
1. Do not mess it up with number of islands. Each path extends only choose one. ...
分类:
其他好文 时间:
2016-07-02 06:58:50
阅读次数:
134
3. Longest Substring Without Repeating Characters 我的DP解法,可行 需要 hashmap 辅助保存各个字符的位置,且随时更新最新位置 若第 i 个位置的字符 c 出现过,则 dp[i] = min(map.get(c)-i,dp[i+1]+1) 若 ...
分类:
其他好文 时间:
2016-06-30 18:00:56
阅读次数:
127
最长回文子串 可以采用DP法,遍历法以及manacher算法 目前自己只实现了遍历法,因为比较直观而且简单- -,之后再完善。 个人感觉此问题可以作为学习动态规划的题目,目前还在学习动态规划中,处于能理解能看懂,但是还不能将动态规划作为解题工具的状态,需要理解更深刻。 遍历法: 简单来说就是遍历字符 ...
分类:
其他好文 时间:
2016-06-30 16:13:06
阅读次数:
112
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 ...
分类:
编程语言 时间:
2016-06-29 13:03:48
阅读次数:
204
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 ...
分类:
编程语言 时间:
2016-06-29 13:00:29
阅读次数:
138
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 longes ...
分类:
其他好文 时间:
2016-06-28 00:41:08
阅读次数:
132
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2016-06-28 00:40:00
阅读次数:
162
Difficulty: Medium Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "a ...
分类:
其他好文 时间:
2016-06-26 23:48:37
阅读次数:
137
5. Longest Palindromic Substring Total Accepted: 115366 Total Submissions: 492202 Difficulty: Medium Given a string S, find the longest palindromic su ...
分类:
其他好文 时间:
2016-06-25 23:05:59
阅读次数:
144