100% faster!!!🔥🔥🔥🔥 Easy Java Soln.with explanation.
\n\n# Approach\n Describe your approach to solving the problem. \nWe first sort the nums array(since we just need to calculate the maximum subsequence length th
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe first sort the nums array(since we just need to calculate the maximum subsequence length that can add up to  queries or less than that).\nWe traverse over each element of the queries array and take the elements from the sorted nums array that sum upto queries or less than that.\nEvery time we take an element from the nums array we increase our counter variable by 1.\nwe add the final counter value to a result array.\n\n# Complexity\n- Time complexity: O(mxn)\nm = queries.length.\nn = nums.length.\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution {\n    public static int[] answerQueries(int[] nums, int[] queries) {\n        int ql=queries.length;\n        int[] res = new int[ql];\n        int nl = nums.length;\n        Arrays.sort(nums);\n        for(int i=0;i<ql;i++)\n        {\n            int sum=0;\n            int ind=0;\n            int c=0;\n            while(ind<nl)\n            {\n                if(sum+nums[ind]<=queries[i]) {\n                    sum += nums[ind];\n                    c++;\n                }\n                ind++;\n\n            }\n            res[i]=c;\n        }\n        return res;\n    }\n}\n```
['Java']