Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 1.32 KB

0078-subsets.adoc

File metadata and controls

66 lines (50 loc) · 1.32 KB

78. Subsets

{leetcode}/problems/subsets/[LeetCode - 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 类似。

{image_attr}
{image_attr}
{image_attr}
{image_attr}
一刷
link:{sourcedir}/_0078_Subsets.java[role=include]
二刷
link:{sourcedir}/_0078_Subsets_2.java[role=include]