Write a function to find the longest common prefix string amongst an array of strings.Solution: 1 class Solution { 2 public: 3 string longestCommo...
分类:
其他好文 时间:
2015-08-09 00:18:55
阅读次数:
105
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-08-09 00:17:57
阅读次数:
86
【104-Maximum Depth of Binary Tree(二叉树的最大深度)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from th...
分类:
编程语言 时间:
2015-08-08 07:59:24
阅读次数:
126
DescriptionOnce upon a time there was a greedy King who ordered his chief Architect to build a wall around the King’s castle. The King was so greedy, that he would not listen to his Architect’s proposa...
分类:
其他好文 时间:
2015-08-07 22:27:06
阅读次数:
160
题目传送门 1 /* 2 LPS(Longest Palidromic Subsequence):最长回文子序列,和回文串不同,子序列是可以不连续的。 3 转化为LCS问题,将字符串逆序,然后和本串求LCS就是LPS的长度(为啥不就是LPS?),但是前一半是LPS的一半,可以...
分类:
其他好文 时间:
2015-08-07 18:53:21
阅读次数:
190
题目Write a function to find the longest common prefix string amongst an array of strings.分析该题目是求一个字符串容器中所有字符串的最长公共前缀。AC代码class Solution {
public:
string longestCommonPrefix(vector& strs) {...
分类:
其他好文 时间:
2015-08-06 17:02:30
阅读次数:
168
echo " ls *.$2 | while read file;do grep -n $1 $file | while read out; do echo $file,$out;done; done">search.sh搜索:sh search.sh get_longest_overlap c即可...
分类:
系统相关 时间:
2015-08-06 12:41:38
阅读次数:
166
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-08-05 12:27:30
阅读次数:
108
题目: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 farthest...
分类:
其他好文 时间:
2015-08-05 07:44:48
阅读次数:
139
问题:Given an array of N integer, find the length of the longest increasing subsequence.For example, given [1,-5,4,5,10,-1,-5,7], the longest increasing...
分类:
编程语言 时间:
2015-08-05 00:40:24
阅读次数:
154