LeetCode75-2300-Successful-Pairs-of-Spells-and-Potions
🧠 Summary of Thoughts
Sort + Binary Search for the first valid threshold
- For each spell, count how many potions satisfy:
spell * potion >= success - If a potion works, then all stronger potions will also work. So this actually transfer the quesiton to asking what is the index of threshold (Binary Search)
- potion >= ceil(success / spell)
ceil(a / b) = (a + b - 1) / b
✅ Code(Java)
1 | |
LeetCode75-2300-Successful-Pairs-of-Spells-and-Potions
https://powersixxx.github.io/leetcode-blog/2026/04/09/LeetCode75-2300-Successful-Pairs-of-Spells-and-Potions/