Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2017-01-31 10:33:20
阅读次数:
205
Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any ...
分类:
其他好文 时间:
2017-01-30 10:36:35
阅读次数:
230
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2017-01-26 01:07:28
阅读次数:
198
题目: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthe ...
分类:
其他好文 时间:
2017-01-25 13:36:46
阅读次数:
187
思路:类似双指针,用left标定以当前字母结尾的最长无重的substring的起点。逐个扫描字母,如果这个字母当前的substring里面没有,那么当前的substring长度就可以加一。如果这个字母已经在substring里面了,例如: 当扫描到第二个c的时候,left应该移到d上来。并且应该将 ...
分类:
其他好文 时间:
2017-01-24 13:36:07
阅读次数:
195
这类问题可以先用递归思考,再反过来想出动态规划的方法。 10. Regular Expression Matching 32. Longest Valid Parentheses 44. Wildcard Matching 72. Edit Distance 97. Interleaving Str ...
分类:
其他好文 时间:
2017-01-22 13:51:20
阅读次数:
210
倒序查看,不包含jiuzhang ladders中出现过的题。 1 Longest Substring Without Repeating Characters not bug free 给一个字符串,找出其中不包含重复字符的最长子串的长度。 Examples: Given "abcabcbb", ...
分类:
其他好文 时间:
2017-01-20 16:08:00
阅读次数:
200
Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than ...
题目要求求出长度即可,并不需要求出最长回文串。思路:用字典统计每一个字符的出现次数,出现次数大于1的字符必定出现在回文串中,另外还再加上一个中心点。public static int LongestPalindrome(string s) { int length = 0; Dictionary d... ...
分类:
其他好文 时间:
2017-01-10 23:40:59
阅读次数:
230
The longest day has an end. 最难过的日子也会有尽头。 No, no, no, I can't see the end of such days, of course, if I choose to commit suicide, then all the miserabl ...
分类:
其他好文 时间:
2017-01-09 18:44:44
阅读次数:
171