SIMPLE PREFIX SUM + BINARY SEARCH 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: O(nlog n + mlogn) , mlog for upper_bound \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:o(n+m)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\nclass Solution {\npublic:\n    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {\n        sort(nums.begin(), nums.end());\n        int n = nums.size();\n        vector<int> prefix(n);\n        prefix[0] = nums[0];\n        for (int i = 1; i <n; i++) {\n            prefix[i] = nums[i] + prefix[i - 1];\n        }\n        vector<int> ans(queries.size());\n      \n        for (int i = 0; i < queries.size(); i++){\n            ans[i] = upper_bound(prefix.begin(), prefix.end(), queries[i]) - prefix.begin();\n        }\n\n        return ans;\n    }\n};\n```
['C++']