Dsa
Backtracking
Warm-up
Subsets of Unique Elements
Given a list of unique integers, return all possible subsets (the power set). The subsets should be returned in any order.
Input format:
- A single line containing space-separated integers.
Output format:
- A list of lists, where each list represents a subset.
Example:
Input:
1 2 3
Output:
[[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
Key concepts
backtrackingsubsets
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