Algorithms Playbook
← All problems
MediumSubsets & combinations →Similar to: Subsets

Every possible team

Problem

Given an array of distinct integers, return all possible subsets (the power set), in any order. The empty subset counts.

Examples

Input: [1, 2, 3]

Output: [], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]

Input: [0]

Output: [], [0]

Hints

    Try it first. Every hint reveals a bit more.

    Solution