Java Easy Solution
\npublic int[] answerQueries(int[] nums, int[] queries) {\n        int[] res = new int[queries.length];\n        Arrays.sort(nums);\n        for(int i = 0; i < 
```\npublic int[] answerQueries(int[] nums, int[] queries) {\n        int[] res = new int[queries.length];\n        Arrays.sort(nums);\n        for(int i = 0; i < res.length; i++){\n            res[i] = getRes(nums, queries[i]);\n        }\n        return res;\n    }\n    private int getRes(int[] nums, int sum){\n        int res = 0, count = 0;\n        for(int i = 0; i < nums.length; i++){\n            if(res+nums[i] <= sum){\n                res += nums[i];\n                count++;\n            }\n            else return count;\n        }\n        return count;\n    }\n```
['Java']