随笔分类 -  recurse

上一页 1 2

[leetcode]Pow(x, n)
摘要:Pow(x, n)Implement pow(x,n).算法思路:二分法,没什么好说的,小心点就行;这个题时间比较苛刻。return pow(x,n >> 1) * pow(x,n >> 1) 是过不去的,因此把pow(x,n / 2)求出来先。其实时间复杂度而言,是一样的。【注意】:n的取值范围;... 阅读全文

posted @ 2014-07-25 23:31 喵星人与汪星人 阅读(172) 评论(0) 推荐(0) 编辑

[leetcode]Subsets II
摘要:Subsets IIGiven a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descend... 阅读全文

posted @ 2014-07-25 22:57 喵星人与汪星人 阅读(254) 评论(0) 推荐(0) 编辑

[leetcode]Subsets
摘要:SubsetsGiven a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must... 阅读全文

posted @ 2014-07-25 22:40 喵星人与汪星人 阅读(236) 评论(0) 推荐(0) 编辑

[leetcode]Gray Code
摘要:Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot... 阅读全文

posted @ 2014-07-23 22:16 喵星人与汪星人 阅读(274) 评论(0) 推荐(0) 编辑

[leetcode]Permutation Sequence
摘要:Permutation SequenceThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the fo... 阅读全文

posted @ 2014-07-23 20:32 喵星人与汪星人 阅读(329) 评论(0) 推荐(0) 编辑

上一页 1 2