C++ | | Binary Search
\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        sort(potions.begin(), potions.end());\n        vector<int> ans;\n        for(long it: spells)\n        {\n            int start=0;\n            int end=n-1;\n            int count=0;\n            \n            while(start<=end)\n            {\n                int mid=(start+end)/2;\n                if(it*potions[mid]>=success)\n                {\n                    count+=end-mid+1;\n                    end=mid-1;\n                }\n                else\n                    start=mid+1;\n            }\n            ans.push_back(count);\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'Sorting', 'Binary Tree', 'C++']