java easy solution
\nclass Solution {\n    public int[] answerQueries(int[] nums, int[] queries) {\n        Arrays.sort(nums);\n        int[] ans=new int[queries.length];\n       
```\nclass Solution {\n    public int[] answerQueries(int[] nums, int[] queries) {\n        Arrays.sort(nums);\n        int[] ans=new int[queries.length];\n        for(int i=0;i<queries.length;i++)\n        {\n            int sum=0;\n            for(int j=0;j<nums.length;j++)\n            {\n                sum+=nums[j];\n                if(sum>queries[i])\n                {\n                    ans[i]=j;\n                    break;\n                }\n                if(j==nums.length-1 && sum<=queries[i])\n                    ans[i]=j+1;\n            }\n        }\n        return ans;\n    }\n}\n```
['Sorting', 'Java']