Dsa
Recursion
Medium
Unique Subsets Generator
Given a list of integers, return all possible unique subsets of the list. The list may contain duplicates. Each subset should be printed in ascending order.
Input:
A single line containing space-separated integers.
Output:
Print each unique subset on a new line, with subsets in ascending order.
Example:
Input:
1 2 2
Output:
[]
[1]
[1, 2]
[1, 2, 2]
[2]
Key concepts
recursioncombinationsarrangements
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now