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 leaf node.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-10-06 16:08:40
阅读次数:
181
You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati...
分类:
其他好文 时间:
2014-10-06 14:58:50
阅读次数:
148
[leetcode]Given a string s, partition s such that every substring of the partition is a palindrome....
分类:
其他好文 时间:
2014-10-06 12:19:50
阅读次数:
200
【leetcode】Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s....
分类:
其他好文 时间:
2014-10-06 12:12:00
阅读次数:
149
Have you ever wondered how the information gets into the application installed in your mobile device, how it is updated, and how it is synchronized wi...
分类:
移动开发 时间:
2014-10-06 11:26:00
阅读次数:
310
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 leaf node.
点击打开原题链接
这个题剑指offer里也有,简单的递归即可,代码很清晰:...
分类:
其他好文 时间:
2014-10-05 22:56:09
阅读次数:
185
最长上升子序列LIS问题属于动态规划的初级问题,用纯动态规划的方法来求解的时间复杂度是O(n^2)。但是如果加上二叉搜索的方法,那么时间复杂度可以降到nlog(n)。 具体分析参考:http://blog.chinaunix.net/uid-26548237-id-3757779.html 代...
分类:
其他好文 时间:
2014-10-05 22:41:09
阅读次数:
194
Write a function to find the longest common prefix string amongst an array of strings.class Solution: # @return a string #最长公共前缀 def longestC...
分类:
编程语言 时间:
2014-10-05 20:35:58
阅读次数:
202
作者: 铁锚日期: 2014年8月10日Redis对于Linux是官方支持的,安装和使用没有什么好说的,普通使用依照官方指导,5分钟以内就能搞定。详情请參考:http://redis.io/download但有时候又想在windows下折腾下Redis,能够从redis下载页面看到例如以下提示:Wi...
论文里面的神题,题意大概是找出当前字符串中的一个子串,使得这个子串由N个字符串循环构成,输出N最大的子串,如果有多输出字典序最小的一个。解决方法感觉很犀利。。首先,对于循环节长度为L的子串,必然有这个子串会经过str[0],str[L],str[2*L]...中的任意两个字符,也就是必然会经过str...
分类:
其他好文 时间:
2014-10-04 23:57:07
阅读次数:
319