参考:https://www.felix021.com/blog/read.php?2040,https://segmentfault.com/a/1190000002991199 做了修改。 首先用一个非常巧妙的方式,将所有可能的奇数/偶数长度的回文子串都转换成了奇数长度:在每个字符的两边都插入一 ...
分类:
其他好文 时间:
2018-03-02 22:07:31
阅读次数:
151
C++解法一: 算法解读:1) 这里使用哈希的思想,把256个可能的字符都考虑在内,字符的ASCⅡ编码作为数组下标进行映射。如m[a]等价于m[97]。2) res其实是result的缩写,表示返回的最大无重复子串的长度,left表示当前正在判断的子串的起始位置。3) 进行一个for循环,当满足(m ...
分类:
其他好文 时间:
2018-03-01 20:03:43
阅读次数:
153
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 ...
分类:
其他好文 时间:
2018-03-01 17:06:59
阅读次数:
169
https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/description/Given a binary tree, find the length of the longest consecutive seq... ...
分类:
其他好文 时间:
2018-03-01 11:38:14
阅读次数:
142
Sorted by frequency of problems that appear in real interviews.Last updated: October 2, 2017Google (214)534 Design TinyURL388 Longest Absolute File Pa ...
分类:
其他好文 时间:
2018-02-27 10:24:36
阅读次数:
388
https://leetcode.com/problems/maximum-depth-of-binary-tree/description/Given a binary tree, find its maximum depth.The maximum depth is the number of ... ...
分类:
其他好文 时间:
2018-02-27 10:23:20
阅读次数:
189
No. Title Level Rate 1 Two Sum Medium 17.70% 2 Add Two Numbers Medium 21.10% 3 Longest Substring Without Repeating Characters Medium 20.60% 4 Median o... ...
分类:
其他好文 时间:
2018-02-27 10:20:26
阅读次数:
240
题目:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the l ...
分类:
其他好文 时间:
2018-02-26 11:20:07
阅读次数:
187
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the lo ...
分类:
其他好文 时间:
2018-02-25 19:13:20
阅读次数:
143
最长的回文字符串第二部分 原文为英文页面,地址:https://articles.leetcode.com/longest-palindromic-substring-part-ii/ 给定一个字符串S,找到S中最长的回文子字符串。 注意:这是文章的第二部分:最长回文子串。在这里,我们描述了一个算法 ...
分类:
其他好文 时间:
2018-02-23 20:43:57
阅读次数:
217