Trains the technique from
LeetCode 2300Successful Pairs of Spells and PotionsThis 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 workshop has presses with forces presses and dies with ratings dies. Pairing a press with a die makes a stamp whose strength is the two numbers multiplied, and the pairing holds when that strength is at least target.
Return a list whose entry i says how many of the dies hold when paired with press i.
Example 1
The weakest press reaches the target only with the highest-rated die. Each of the other two presses manages it with two dies.
Example 2
Three times three lands exactly on the target, and a pairing holds when it reaches the target rather than having to pass it.
Example 3
The single die is rated 1, so a press holds only when its own force reaches the target.
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 successful_pairs(presses: list[int], dies: list[int], target: int) -> list[int]:public int[] successfulPairs(int[] presses, int[] dies, long target)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.