Prefix Sum + Upper Bound in C++
\nclass Solution {\npublic:\n    vector<int> answerQueries(vector<int>& a, vector<int>& b) {\n        vector<int>ans;\n        // Required maxium size that\'s w
```\nclass Solution {\npublic:\n    vector<int> answerQueries(vector<int>& a, vector<int>& b) {\n        vector<int>ans;\n        // Required maxium size that\'s why it need to sorted (lower value come first).          \n        sort(a.begin(),a.end());\n        //question required return size of sum so need to calculate Prefix sum for \n        for(int i=1;i<a.size();i++){\n            a[i]=a[i]+a[i-1];\n        }\n        \n        for(int i=0;i<b.size();i++){\n            //upper bound => It always return just upper index (if answer exits or not). \n            // Read more -> https://www.javatpoint.com/cpp-algorithm-upper_bound-function\n            int ind = upper_bound(a.begin(),a.end(),b[i])-a.begin();\n            ans.push_back(ind);\n        }\n        return ans;\n    }\n};\n```
['C', 'Sorting', 'Binary Tree', 'Prefix Sum']