Notice Period

Menu Bundle Power Set

medium

A café wants to print every possible combo bundle it could offer from its list of distinct menu item IDs — including the empty bundle (no items) and the full bundle (everything).

Given a list items of distinct integers, return all possible subsets. Each subset is a list; the order of subsets and the order inside each subset don't matter.

Example 1
in items = [1, 2, 3]
out [[], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]]
3 items produce 2^3 = 8 bundles.
Example 2
in items = [0]
out [[], [0]]
Constraints
  • · 1 <= len(items) <= 10
  • · -10 <= items[i] <= 10
  • · all values are distinct
similar problem on LeetCode ↗
solution.pyloading python…
test results
Hit ▶ Run to test your code against the visible cases.