摘要:
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following unique permutations:[1,1,2], [1,2,1], and [2,1,1].第一个版本,加了一个set去除重复class Solution {public: void sub(vector > & ret,vector& num,int index){ if(index= 阅读全文
posted @ 2013-10-05 18:14
懒猫欣
阅读(167)
评论(0)
推荐(0)
摘要:
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].class Solution {public: void sub(vector > & ret,vector& num,int index){ if(index==num.size()){ ret.push_b... 阅读全文
posted @ 2013-10-05 17:41
懒猫欣
阅读(161)
评论(0)
推荐(0)
摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the two partitions. For example,Given 1->4->3->2->5->2 and x = 3,return 1->2->2-&g 阅读全文
posted @ 2013-10-05 17:21
懒猫欣
阅读(161)
评论(0)
推荐(0)
摘要:
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters. For example, given:S: "barfoothefoobarman"L: ["foo", & 阅读全文
posted @ 2013-10-05 01:52
懒猫欣
阅读(165)
评论(0)
推荐(0)
浙公网安备 33010602011771号