Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-06-17 14:48:01
阅读次数:
110
Manacher 算法是时间、空间复杂度都为 O(n) 的解决 Longest palindromic substring(最长回文子串)的算法。回文串是中心对称的串,比如 'abcba'、'abccba'。那么最长回文子串顾名思义,就是求一个序列中的子串中,最长的回文串。本文最后用 Python ...
分类:
编程语言 时间:
2015-06-16 20:49:30
阅读次数:
354
problem: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 uniqu...
分类:
其他好文 时间:
2015-06-16 18:32:29
阅读次数:
113
题目描述:求两个输入序列的最长的公共子字符串的长度。子字符串中的所有字符在源字符串中必须相邻。如字符串:21232523311324和字符串312123223445,他们的最长公共子字符串为21232,长度为5。最长公共子串(Longest Common Substirng)和最长公共子序列(Lon...
分类:
其他好文 时间:
2015-06-16 16:32:26
阅读次数:
75
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-06-15 13:04:56
阅读次数:
82
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