Problem
You have two lists of positive integers, spells and potions, and a number success. A spell and a potion form a successful pair when the product of their strengths is at least success. For each spell, count how many potions it pairs with successfully, and return the counts as a list.
Example 1
- Input
- spells = [5, 1, 3], potions = [1, 2, 3, 4, 5], success = 7
- Output
- [4, 0, 3]
Example 2
- Input
- spells = [3, 1, 2], potions = [8, 5, 8], success = 16
- Output
- [2, 0, 2]
In the first example, spell 5 works with potions 2, 3, 4 and 5 (products 10 to 25), spell 1 with none, and spell 3 with potions 3, 4 and 5.
Constraints
1 <= spells.length, potions.length <= 10^51 <= spells[i], potions[i] <= 10^51 <= success <= 10^10