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 ...
分类:
其他好文 时间:
2016-10-12 11:13:32
阅读次数:
141
题目: Write a function to find the longest common prefix string amongst an array of strings. 官方难度: Easy 翻译: 写一个函数,用来寻找一个字符串数组中的最长公共前缀。 思路: 1. 长度为0的数组直接退 ...
分类:
其他好文 时间:
2016-10-12 10:51:29
阅读次数:
122
昨儿,小爷在LeetCode上刷了一道题,关于把两个字符串型的整数加和的问题(当然不能直接强转),链接在这https://leetcode.com/problems/add-strings/,感兴趣的朋友们可以一试,不难,只要想做肯定做得出,无非就是要想想进位和哪个字符串位数多的问题,提交几次考虑的 ...
分类:
其他好文 时间:
2016-10-10 19:12:12
阅读次数:
151
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2016-10-10 07:44:45
阅读次数:
166
最长公共子串(Longest Common Substirng)和最长公共子序列(Longest Common Subsequence,LCS)的区别为:子串是串的一个连续的部分,子序列则是从不改变序列的顺序,而从序列中去掉任意的元素而获得新的序列;也就是 说,子串中字符的位置必须是连续的,子序列则 ...
分类:
其他好文 时间:
2016-10-09 23:13:22
阅读次数:
158
寻找最长的不重复串,略像滑动窗口。 上面这个粗鲁的代码,马马虎虎毕竟打败51 ~61%的code,lastIndexOf有优化的空间。 不过答案真是美妙的活动窗口实现,赞!使用了字符作为坐标,索引作为值。 ...
分类:
其他好文 时间:
2016-10-08 18:48:59
阅读次数:
112
A palindrome is a string that reads the same from the left as it does from the right. For example, I, GAG and MADAM are palindromes, but ADAM is not. ...
分类:
其他好文 时间:
2016-10-07 20:43:22
阅读次数:
161
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2016-10-07 15:43:12
阅读次数:
149
题目如下: 此题用Manacher算法求解,时间复杂度为O(n) Python代码: ...
分类:
其他好文 时间:
2016-10-07 14:07:23
阅读次数:
151