摘要:
给定正整数n,求1,2,3,...,n的全排列解法一:递归,结果并不为字母序排列。void Helper(vector v, int low, int high){ if(low == high) { for(int i = 0; i v(n,0); for(int... 阅读全文
posted @ 2014-12-10 20:43
陆草纯
阅读(361)
评论(0)
推荐(0)
摘要:
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-12-10 20:02
陆草纯
阅读(1540)
评论(0)
推荐(0)
摘要:
Rotate ListGiven a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3-... 阅读全文
posted @ 2014-12-10 14:44
陆草纯
阅读(1104)
评论(0)
推荐(0)
摘要:
Unique Paths IIFollow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle an... 阅读全文
posted @ 2014-12-10 13:36
陆草纯
阅读(431)
评论(0)
推荐(0)
摘要:
Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a... 阅读全文
posted @ 2014-12-10 13:17
陆草纯
阅读(3079)
评论(0)
推荐(1)
摘要:
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir... 阅读全文
posted @ 2014-12-10 12:54
陆草纯
阅读(154)
评论(0)
推荐(0)
摘要:
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".先进行对齐操作,然后从右往左逐位相加,注意进位即可。class Solut... 阅读全文
posted @ 2014-12-10 11:29
陆草纯
阅读(2318)
评论(0)
推荐(0)
摘要:
Valid NumberValidate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the ... 阅读全文
posted @ 2014-12-10 10:59
陆草纯
阅读(204)
评论(0)
推荐(0)