F_G

许多问题需要说清楚就可以&&走永远比跑来的重要

导航

2015年8月18日 #

[Hulu 2014] 两递增数组A和B,求A[i]+B[j]中前k个最小值

摘要: 在许多地方发现了对这个提的介绍关键是对下个最小的状态的选取,需要证明一下。[2]使用了程序判断是否重复的方式,并且覆盖了equals方法,可以借鉴一下![1] http://www.cnblogs.com/weixliu/p/3779288.html[2] http://blog.csdn.net/... 阅读全文

posted @ 2015-08-18 21:48 F_G 阅读(215) 评论(0) 推荐(0) 编辑

[Leetcode] Count Complete Tree Nodes

摘要: Count Complete Tree NodesGiven acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary... 阅读全文

posted @ 2015-08-18 20:19 F_G 阅读(163) 评论(0) 推荐(0) 编辑

[Leetcode] Linked List Cycle II

摘要: 如何找到环的起始位置?算法大家估计都已经是耳熟能详了,关键是证明。我们假设从起始位置到环的起点的长度为X,相遇位置离起始点的距离为K,环的长度为Y,由于fast pointer的速度是low pointer的两倍。所以X+mY+K=2*(X+nY+K)X+K=(m-2n)Y从这个等式可以解释为什么:... 阅读全文

posted @ 2015-08-18 09:15 F_G 阅读(115) 评论(0) 推荐(0) 编辑

[Leetcode] Single Number II

摘要: 参考当中有对一个bug的说明[1] http://shmilyaw-hotmail-com.iteye.com/blog/2153924 阅读全文

posted @ 2015-08-18 08:34 F_G 阅读(101) 评论(0) 推荐(0) 编辑