码迷,mamicode.com
首页 >  
搜索关键字:hdu1219 ac me    ( 16537个结果
LeetCode OJ - Minimum && Maximum Depth of Binary Tree
这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a binary tree, find its minimum depth. 3 * the minimum depth is the number of nodes along th...
分类:其他好文   时间:2014-05-10 08:47:32    阅读次数:271
LeetCode OJ - Distinct Subsequence
这道题采用动态规划,可是我一开始没有想到。后来参考了discuss中前辈的代码和思路,才想通的。 方法二是因为每一步只和上一步的内容相关,所以可以只用O(n)的空间复杂度。下面是AC代码: 1 /** 2 * Solution DP 3 * we keep a m*n matri...
分类:其他好文   时间:2014-05-10 08:43:12    阅读次数:319
LeetCode OJ - construct Binary Tree from Inorder and Postorder/Preorder Traversal
不断递归的实现!!!!下面是AC代码: 1 /** 2 * Given inorder and postorder traversal of a tree, construct the binary tree. 3 * @param inorder 4 * @param...
分类:其他好文   时间:2014-05-10 08:40:40    阅读次数:297
大神的算法学习之路
http://zh.lucida.me/
分类:其他好文   时间:2014-05-09 18:29:17    阅读次数:245
Linux服务器SNMP常用OID (转)
原文地址:http://www.haiyun.me/archives/linux-snmp-oid.html收集整理一些Linux下snmp常用的OID,用做服务器监控很不错。服务器负载:1231 minute Load: .1.3.6.1.4.1.2021.10.1.3.15 minute Loa...
分类:系统相关   时间:2014-05-08 20:17:02    阅读次数:616
阅读http://zh.lucida.me/有感
lucida大神本科毕业于大工,研究生毕业于北航,有这样的学历在社会上混就已经绰绰有余了,但是lucida神并不满足,刻苦努力,拼搏进取,最后进入google london工作,曾经一度在microsoft实习,这样的经历让我羡慕不已,但是更让人激情四射的还在后头: 话说每一个成功人士都有那么一段....
分类:其他好文   时间:2014-05-08 20:05:09    阅读次数:482
DP入门数塔问题
在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整...
分类:其他好文   时间:2014-05-07 10:19:03    阅读次数:276
LeetCode OJ - Validate Binary Search Tree
验证二叉树是否是查找树,可以通过查看它的中序遍历是否是升序的。下面是AC代码: 1 /** 2 * Given a binary tree, determine if it is a valid binary search tree (BST). 3 * solution : 4...
分类:其他好文   时间:2014-05-07 09:01:45    阅读次数:250
LeetCode OJ - Symmetric Tree && Same Tree
这两道题,大同小异。 我都是用BFS,在遍历的过程,判断结构是否相同/对称,值是否相同。下面是AC代码: 1 /** 2 * Given a binary tree, check whether it is a mirror of itself (ie, symmetric aroun...
分类:其他好文   时间:2014-05-05 09:48:26    阅读次数:401
LeetCode OJ - Binary Tree Level Order Traversal 1 && 2
BFS以及它的扩展,我发现栈是个很好用的数据结构,特别是对于顺序需要颠倒的时候!!!这里有个重要的信息:可以用null来标识一个level的结束!!!下面是AC代码: 1 /** 2 * Given a binary tree, return the bottom-up level ord...
分类:其他好文   时间:2014-05-05 09:46:06    阅读次数:402
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!