Successful Pairs of Spells and Potions C++ solution
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\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```
['C++']