Sort + Binary Search | C++
\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        int n = potions.size();\n 
```\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        int n = potions.size();\n        vector<int> ans;\n        sort(potions.begin(), potions.end());\n\n        for(int i : spells) {\n            int pos = lower_bound(potions.begin(), potions.end(), ceil((double)success / i)) - potions.begin();\n            ans.push_back(n - pos);\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'Sorting', 'C++']