Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Friday, October 17, 2014
Subsets
Problem
Given 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 not contain duplicate subsets.
For example,
If S = [1,2,3], a solution is:
Idea
递归来做就可以,其实对于每一个s[i]来说,只有两个操作,子集包含s[i]和子集不包含s[i].
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment