Trains the technique from
LeetCode 77CombinationsThis 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 cellar stores casks barrels, numbered 1 through casks. A tasting flight is a selection of exactly pour different barrels; two flights are the same flight when they draw from the same set of barrels, no matter which barrel was poured first.
Return every flight the cellar can serve. Each flight must list its barrel numbers in increasing order, and the flights themselves may be returned in any order.
Example 1
Ten different sets of three barrels can be drawn from five, and each one is listed with its barrel numbers increasing.
Example 2
A flight of three from three barrels can only draw all of them, so there is a single flight.
Example 3
Each barrel on its own is a flight of one, so both single-barrel flights are returned; the order of the flights does not matter.
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 list_flights(casks: int, pour: int) -> list[list[int]]:public List<List<Integer>> listFlights(int casks, int pour)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.