[Binary Search] Easy Solution in Python
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def successfulPairs(self, spells: List[int], potions: List[int], success: int) -> List[int]:\n        res = [0] * len(spells)\n        potions.sort()\n\n        for i in range(len(spells)):\n            # find the smallest value to reach in spells\n            needed = success//spells[i] + bool(success % spells[i])\n\n            l, r = 0, len(potions) # r should start with len(potions) to give a full range from 0 to len(potions) to l\n            while l < r:\n                mid = l + (r - l) // 2\n                if potions[mid] < needed:\n                    l = mid + 1\n                else:\n                    r = mid\n                res[i] = len(potions) - l\n\n        return res\n```
['Python3']