✅C++ | ✅Use Binary Search | ✅Efficient solution
\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) \n    {\n        int sn = spells.size
```\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) \n    {\n        int sn = spells.size();\n        int pn = potions.size();\n        vector<int> ans; //stores answer\n        \n        sort(potions.begin(), potions.end()); //sort potions for binary search\n        \n        for(auto it : spells)\n        {\n            int left=0, right=pn-1, mid; //define left, right and mid pointers\n            \n            while(left<=right) //iterate until right is lesser than left\n            {\n                mid = (left+right)>>1; \n                \n                if((long long)it*potions[mid] >= success) right=mid-1;\n                \n                else left=mid+1;\n            }\n            ans.push_back(pn-left);\n        }\n        return ans;\n        \n    }\n};\n```\n\n# Please upvote if you like this approach :)
['Binary Search', 'C', 'Sorting', 'Binary Tree', 'C++']