Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 1.09 KB

0078-subsets.adoc

File metadata and controls

69 lines (50 loc) · 1.09 KB

78. Subsets

Given a set of distinct integers, nums, return all possible subsets (the power set).

Note: The solution set must not contain duplicate subsets.

Example:
Input: nums = [1,2,3]
Output:
[
  [3],
  [1],
  [2],
  [1,2,3],
  [1,3],
  [2,3],
  [1,2],
  []
]

解题分析

这道题跟 90. Subsets II 类似。

0078 subsets recursion
0078 subsets combinations
0078 subsets backtracking
0078 subsets bitmask4

参考资料

Given a set of distinct integers, nums, return all possible subsets (the power set).

Note: The solution set must not contain duplicate subsets.

Example:

Input: nums = [1,2,3]
Output:
[
  [3],
  [1],
  [2],
  [1,2,3],
  [1,3],
  [2,3],
  [1,2],
  []
]
link:{sourcedir}/_0078_Subsets.java[role=include]