Practice Successful Pairs of Spells and Potions
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Successful Pairs of Spells and Potions
Problem Statement
You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potions[j] represents the strength of the jth potion. You are also given an integer success. A spell and potion pair is considered successful if the product of their strengths is at least success. Return an integer array pairs of length n where pairs[i] is the number of potions that will form a successful pair with the ith spell.
Source: Successful Pairs of Spells and Potions on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
spells = [5,1,3], potions = [1,2,3,4,5], success = 7
[4,0,3]
# Example 2
spells = [3,1,2], potions = [8,5,8], success = 16
[2,0,2]
Constraints
Related LeetCode Problems
Practice more problems similar to Successful Pairs of Spells and Potions.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.