O(N+M) Approach || C++ || Without binary Search and sort || Easy || Faster
\nclass Solution {\npublic:\n    \n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        int maxi = 0;\n     
```\nclass Solution {\npublic:\n    \n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        int maxi = 0;\n        unordered_map<int,int> dp;\n        for(int i = 0 ; i<potions.size() ; i++){\n            dp[potions[i]]++;\n            maxi = max(potions[i],maxi);\n        }\n        \n        vector<int> refer(maxi+1);\n        \n        refer[refer.size()-1] = dp[refer.size()-1];\n        \n        for(int i = refer.size()-2 ; i >= 0 ; i--){\n            refer[i] = refer[i+1] + dp[i];\n        }\n        \n        vector<int> result(spells.size());\n        \n        for(int i = 0 ; i < spells.size() ; i++){\n            double t1 = success;\n            double t2 = spells[i];\n            long long temp = ceil(t1/t2);\n            if(temp > maxi){\n                result[i] = 0;\n                continue;\n            }\n            result[i]= refer[temp];\n        }\n        return result;\n    }\n};\n```
['C', 'C++']