This is the classic LCS problem. Since it requires you to print one longest common subsequence, just use the O(m*n)-space version here.My accepted cod...
分类:
其他好文 时间:
2015-06-15 00:13:35
阅读次数:
112
This is the classic LCS problem. Since it only requires you to print the maximum length, the code can be optimized to use only O(m) space (seehere).My...
分类:
其他好文 时间:
2015-06-15 00:10:20
阅读次数:
157
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 le...
分类:
其他好文 时间:
2015-06-15 00:07:45
阅读次数:
142
目录:总结思路与实现我自己的一些笔记,关于java基本知识1. 总结现在的习惯是,先考虑正确case,然后考虑边界条件写注释leetcode代码提交方式:需要的是按照classSolution给的接口来实现它的一个成员函数。可以在main中调用该函数来测试。写循环时,要考虑【跳出循环的条件】2. 思...
分类:
其他好文 时间:
2015-06-14 18:20:43
阅读次数:
120
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 le...
分类:
其他好文 时间:
2015-06-14 16:30:11
阅读次数:
79
1 题目:Write a function to find the longest common prefix string amongst an array of strings.Hide TagsString2 思路所有字符串公共的前缀,那么第一个字符串肯定包括了。 从第一个字符串开始遍历着手即...
分类:
其他好文 时间:
2015-06-14 16:26:59
阅读次数:
102
The Longest Common Subsequence (LCS) problem is as follows:Given two sequences s andt, find the length of the longest sequence r, which is a subsequen...
分类:
其他好文 时间:
2015-06-14 00:30:15
阅读次数:
177
The Longest Common Substring (LCS) problem is as follows:Given two strings s and t, find the length of the longest string r, which is a substring of b...
分类:
其他好文 时间:
2015-06-13 23:04:33
阅读次数:
120
This problem is a nice extension of the Valid Parentheses problem.There are several ways to solve it. The first idea is also to use a stack. However, ...
分类:
其他好文 时间:
2015-06-13 16:56:41
阅读次数:
130
N*N matrix is given with input red or black.You can move horizontally, vertically or diagonally. If 3 consecutive samecolor found, that color will get...
分类:
其他好文 时间:
2015-06-13 09:46:51
阅读次数:
109