Available question text
For each query, determine the maximum number of elements you can pick from nums (as a subsequence) whose sum is ≤ query — equivalent to choosing as many smallest elements as possible. Sort nums, build prefix sums, and for each query use binary search (or scan) on the prefix sums to get the count.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2389. Longest Subsequence With Limited Sum
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source