Beats 89% || C++ solution using binary search and sorting
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO((m+n)logm) sorting potions vector -> mlogm and applying binary search on potions for every spell nlogm\n\n- Space complexity:\nO(n)  ans vector for return the results\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions,\n                                long long success) {\n\n        // sort the potions and apply binary search in it for every spells\n        vector<int> ans;\n        sort(potions.begin(), potions.end());\n\n        int n = potions.size();\n        int lower = 0, higher = n - 1,index;\n        long long temp ;\n        for (int i = 0; i < spells.size(); i++) {\n            temp= spells[i];\n            \n            // usign binary search find the first index where success is found\n            if (temp * potions[n - 1] < success) {\n                ans.push_back(0);\n                continue;\n            }\n\n            lower = 0, higher = n - 1;\n\n            while (lower <higher) {\n                index = lower+(-lower + higher) / 2;\n\n                if ((long long)(temp * potions[index]) < success) \n                    lower = index + 1;\n                 else\n                    higher = index ;\n            }\n      \n            ans.push_back(n-lower);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Two Pointers', 'Binary Search', 'Sorting', 'C++']