C++ || Prefix sum || Beats 94%
Approach\n\nSteps - \n1. Sort nums in ascending order \n2. Convert nums into prefix sum array\n3. Apply binary search or upper bound for each values in queries 
# Approach\n\nSteps - \n1. Sort `nums` in ascending order \n2. Convert `nums` into prefix sum array\n3. Apply **binary search** or **upper bound** for each values in `queries` on `nums`\n\n# Complexity\n- Time complexity:\n $$O(QlogN)$$\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> answerQueries(vector<int>& nums, vector<int>& que) {\n        vector<int> ans;\n        sort(nums.begin(),nums.end());\n        for(int i=1; i<nums.size(); i++){\n            nums[i] += nums[i-1];\n        }\n\n        for(auto it : que){\n            int index = upper_bound(nums.begin(), nums.end(), it) - nums.begin();\n            ans.push_back(index);\n        }\n        return ans;\n    }\n};\n```
['Binary Search', 'Sorting', 'Prefix Sum', 'C++']