Power Set (Subsets using Bit Manipulation)
Interview Problems DSA practice problem on Onlearn.
Difficulty: medium.
Topics: What is a power set, and how can we generate all subsets of a set (the power set) efficiently?, Power Set, Bitwise Operations, Recursion, Backtracking, Arrays, Time Complexity, Space Complexity, Combinatorics, combinatorics, recursion, backtracking, bit manipulation, Power Set (Bitmasking).
Problem Statement: Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Input Specification: A single line containing space separated integers representing the array nums. Output Specification: Each line should contain a space separated list of integers representing a subset. The order of subsets and elements within subsets does not matter. The empty set should be represented by an empty line or similar appropriate notation depending on output format. Constraints: 1 <= nums.length <= 10 10 <= nums[i] <= 10 All the numbers in nums are unique. Sample Test Case: Input: 1 2 3 Output: (Note: The order of subsets and elements within subsets may vary.)