Problem
You get an array nums of integers. The array can contain the same value more than one time. Return all the different subsets of nums.
A subset is a group of zero or more items from nums. Two subsets are the same when they have the same values the same number of times. The result must not contain the same subset two times.
You can return the subsets in any order. The values inside each subset can also be in any order.
Example 1
- Input:
- nums = [3,3]
- Output:
- [[],[3],[3,3]]
- Explanation:
- Each
3alone gives the subset[3]. The result shows this subset only one time.
Example 2
- Input:
- nums = [1,4,1]
- Output:
- [[],[1],[4],[1,1],[1,4],[1,1,4]]
Example 3
- Input:
- nums = [9]
- Output:
- [[],[9]]
Constraints
- 1 <= nums.length <= 10
- -10 <= nums[i] <= 10
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 90. Subsets II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source