subsets.sh — zsh
arraysbacktrackingrecursionbit-manipulation

Given an integer array nums of unique values, return every subset. Preserve input order inside subsets and use include-first depth-first output order.

Examples
Example 1
Input: nums = [1,2]
Output: [[1,2],[1],[2],[]]
Example 2
Input: nums = []
Output: [[]]
Example 3
Input: nums = [0]
Output: [[0],[]]
🔒 5 hidden
Running will execute all 8 cases, including 5 hidden ones.