✅ JavaScript | Intuitive | Sort | TC O(nm) | SC O(1)
\n/**\n * @param {number[]} nums\n * @param {number[]} queries\n * @return {number[]}\n */\nvar answerQueries = function(nums, queries) {\n    nums.sort((a, b) 
```\n/**\n * @param {number[]} nums\n * @param {number[]} queries\n * @return {number[]}\n */\nvar answerQueries = function(nums, queries) {\n    nums.sort((a, b) => a - b);\n    const ans = [];\n    \n    for (let q of queries) {\n        let cur = 0;\n        for (const n of nums) {\n            if (q - n >= 0) {\n                q -= n;\n                cur++;\n            }\n        }\n        ans.push(cur);\n    }\n    \n    return ans;\n};\n```
['Sorting', 'JavaScript']