A spell and a potion form a successful pair when the product of their strengths is at least success. For each value in spells, count how many entries of potions form a successful pair with it. Return those counts in the same order as spells. Repeated potion strengths count separately, and the same potion can be counted for multiple spells.
Example 1:
Input: spells = [2,5,1]
potions = [2,3,6]
success = 10
Output: [1,3,0]Explanation: The spell of strength 2 succeeds only with potion 6. The spell of strength 5 succeeds with all three potions, while the spell of strength 1 succeeds with none. Return [1,3,0].
Example 2:
Input: spells = [4,2]
potions = [3,3,5]
success = 12
Output: [3,0]Explanation: For strength 4, both potions of strength 3 and the potion of strength 5 succeed. Neither strength-3 potion nor strength-5 potion succeeds with the spell of strength 2, so return [3,0].
Example 3:
Input: spells = [1,100000]
potions = [1,100000]
success = 10000000000
Output: [0,1]Explanation: A spell of strength 1 cannot reach the threshold. The strength-100000 spell succeeds only with the strength-100000 potion, whose product is exactly 10000000000. Return [0,1].
Constraints:
1 <= spells.length, potions.length <= 1000001 <= spells[i], potions[i] <= 1000001 <= success <= 10000000000