LeetCode 78: Subsets
Question
Given a set of distinct integers, nums, return all possible subsets.
Note: The solution set must not contain duplicate subsets.
For example, If nums = [1,2,3], a solution is:
|
|
Explanation
回溯递归
Code
|
|
LeetCode 90. Subsets II
Question
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note: The solution set must not contain duplicate subsets.
For example, If nums = [1,2,2], a solution is:
|
|
Explanation
和上一题一致,只是对于重复的,skip掉。
Code
|
|
LeeCode 46. Permutations
Question
Given a collection of distinct numbers, return all possible permutations.
For example, [1,2,3] have the following permutations:
|
|
Explanation
Code
|
|