[C++] | Binary search | short and simple logic
For each spell,\nneed = success * 1.0 / spell\nBinary search the index of first potion >= need in the sorted potions.\nThe number of potions that are successful
For each spell,\n**need = success * 1.0 / spell**\nBinary search the index of **first potion >= need** in the sorted potions.\nThe number of potions that are successful are **potions.length - index**\n```\nvector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        sort(potions.begin(),potions.end());\n        long long need;\n        vector<int> ans;\n        for(int spell:spells){\n            need=ceil(success*1.0/spell);\n            ans.push_back(potions.end()-lower_bound(potions.begin(),potions.end(),need));\n        }\n        return ans;\n    }\n```\n*-----please upvote-----*
['C', 'Binary Tree']