|
| 1 | +<h2><ahref="https://leetcode.com/problems/subsets/">78. Subsets</a></h2><h3>Medium</h3><hr><p>Given an integer array <code>nums</code> of <strong>unique</strong> elements, return <em>all possible</em> <spandata-keyword="subset"><em>subsets</em></span> <em>(the power set)</em>.</p> |
| 2 | + |
| 3 | +<p>The solution set <strong>must not</strong> contain duplicate subsets. Return the solution in <strong>any order</strong>.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strongclass="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<pre> |
| 9 | +<strong>Input:</strong> nums = [1,2,3] |
| 10 | +<strong>Output:</strong> [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] |
| 11 | +</pre> |
| 12 | + |
| 13 | +<p><strongclass="example">Example 2:</strong></p> |
| 14 | + |
| 15 | +<pre> |
| 16 | +<strong>Input:</strong> nums = [0] |
| 17 | +<strong>Output:</strong> [[],[0]] |
| 18 | +</pre> |
| 19 | + |
| 20 | +<p> </p> |
| 21 | +<p><strong>Constraints:</strong></p> |
| 22 | + |
| 23 | +<ul> |
| 24 | +<li><code>1 <= nums.length <= 10</code></li> |
| 25 | +<li><code>-10 <= nums[i] <= 10</code></li> |
| 26 | +<li>All the numbers of <code>nums</code> are <strong>unique</strong>.</li> |
| 27 | +</ul> |