C++ | Brute Force | O(n^2)
\n\n# Code\n\nclass Solution {\npublic:\n\n    int solve(vector<int>nums, int target){\n        long long int count=0, sum=0;\n        for(int i=0;i<nums.size()
\n\n# Code\n```\nclass Solution {\npublic:\n\n    int solve(vector<int>nums, int target){\n        long long int count=0, sum=0;\n        for(int i=0;i<nums.size();i++){ \n            if((sum+=nums[i])<=target){ \n                count++;\n            }\n        }\n        return count;\n    }\n  \n    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {\n        vector<int>ans;\n        sort(nums.begin(),nums.end());\n        for(int i=0;i<queries.size();i++){\n            int temp = solve(nums, queries[i]);\n            ans.push_back(temp);\n        }\n        return ans;\n    }\n};\n\n\n```
['C++']