✅Python || 2 Easy Approaches || Prefix Sum
\nclass Solution:\n    def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:\n        \n        numsSorted = sorted(nums)\n        res = []
```\nclass Solution:\n    def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:\n        \n        numsSorted = sorted(nums)\n        res = []\n\t\t\n        for q in queries:\n            total = 0\n            count = 0\n            for num in numsSorted:\n                total += num\n                count += 1\n                if total > q:\n                    count -= 1\n                    break\n            res.append(count)\n        \n        return res\n```\n\n\nSolution 2 (Prefix Sum):\n```\nclass Solution:\n    def answerQueries(self, nums: List[int], queries: List[int]) -> List[int]:\n        \n        ans = []\n\n        nums.sort()\n        sumx = []\n        res = 0\n        for x in nums:\n            res += x\n            sumx.append(res)\n\n        for j in range(len(queries)):\n            for i, y in enumerate(sumx):\n                if y <= queries[j]:\n                    continue\n                else:\n                    ans.append(i)\n                    break\n            else:\n                if len(ans) < j + 1:\n                    ans.append(len(nums))\n        \n        return ans\n```
['Python', 'Python3']