Trains the technique from
LeetCode 78SubsetsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A mixing desk exposes a bank of gain trims, given as the integer array offsets. Every trim in the bank carries a different value, and a value may be negative (a cut) or positive (a boost).
A preset is any selection of trims to engage. Engaging none of them is a preset, and so is engaging the whole bank. Build the catalogue of every preset the desk can hold.
Each preset must list its engaged trims in the same relative order they occupy in offsets. The catalogue itself may come back in any order.
Example 1
Two trims give four presets: nothing engaged, each one alone, and both together with 4 still listed ahead of -2.
Example 2
A single trim is either idle or engaged.
Example 3
Three trims give eight presets, each keeping the bank order of the trims it engages.
The values you return may be in any order.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def all_presets(offsets: list[int]) -> list[list[int]]:public List<List<Integer>> allPresets(int[] offsets)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.