Sort potions and apply Binary Search || C++ || Sorting 🟩
\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long k) {\n        sort(potions.begin(),potions.end
```\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long k) {\n        sort(potions.begin(),potions.end());\n        int n = spells.size(), m = potions.size();\n        int i = 0, j = 0;\n        vector<int> res;\n        for(int i=0;i<n;i++){\n            int l = 0, h = m;\n            long long c1 = spells[i];\n            while(l<h){\n                int mid = (l+h)/2;\n                long long c2 = potions[mid];\n                long long cur = c1*c2;\n                if(cur<k) l = mid+1;\n                else if(cur>=k) h = mid;\n            }\n            res.push_back(m-h);\n        }\n        return res;\n    }\n};\n```
['C', 'Sorting']