Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined
between two node...
分类:
其他好文 时间:
2015-08-16 19:52:31
阅读次数:
105
1.获取github中的redis-php扩展代码:git clone https://github.com/phpredis/phpredis.git2.cd phpredis/
3.phpize
!!!!!!!!!!!!!!!!!!!!!!!
3.5 mac os 如果这里有Cannot find autoconf. Please check your autoconf installat...
分类:
Web程序 时间:
2015-08-16 19:50:50
阅读次数:
150
就是比普通的并查集多了个删除操作,显然叶子节点容易删,问题在于可能删根节点。
既然叶子节点容易,我们就把所有的点都变成叶子。我是多开了n个虚拟节点。
(因为我的集合合并是直接连两个根,所以那些有效节点的父亲肯定一直是虚拟节点,所以删除的时候只要考虑一个点就行....其实我是后来才发现,这算是水过吗 QAQ)...
分类:
其他好文 时间:
2015-08-16 19:49:49
阅读次数:
90
题目: 3 个数和问题
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:
Elements in a triplet (a,b...
分类:
其他好文 时间:
2015-08-16 18:25:29
阅读次数:
173
题目:与3数和最接近的和
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would...
分类:
其他好文 时间:
2015-08-16 18:25:25
阅读次数:
126
Problem DescriptionGive you a lot of positive integers, just to find out how many prime numbers there are.InputThere are a lot of cases. In each case,...
分类:
其他好文 时间:
2015-08-16 16:31:59
阅读次数:
101
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ...
分类:
其他好文 时间:
2015-08-16 16:26:47
阅读次数:
96
Word Ladder II描述Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from startto end, such that:? Only one...
分类:
编程语言 时间:
2015-08-16 15:12:33
阅读次数:
266
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1598
find the most comfortable road
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5043 A...
分类:
其他好文 时间:
2015-08-16 13:53:31
阅读次数:
121
Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i...
分类:
其他好文 时间:
2015-08-16 12:04:38
阅读次数:
80