✅C++ | ✅Use sorting & prefix_sum | ✅Easy solution
\nclass Solution \n{\npublic:\n    \n    \n    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) \n    {\n        sort(nums.begin(), nums.end()
```\nclass Solution \n{\npublic:\n    \n    \n    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) \n    {\n        sort(nums.begin(), nums.end());\n        \n        vector<int> pre_sum;\n        int sum=0;\n        \n        for(int i=0; i<nums.size(); i++)\n        {\n            sum += nums[i];\n            pre_sum.push_back(sum);\n        }\n        \n        vector<int> ans(queries.size(), 0);\n        for(int i=0; i<queries.size(); i++)\n        {\n            for(int j=0; j<nums.size(); j++)\n            {\n                if(pre_sum[j] <= queries[i]) ans[i] = j+1;\n                else break;\n            }\n        }\n        return ans;\n        \n    }\n};\n```
['Array', 'C', 'Sorting', 'Prefix Sum', 'C++']