Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Solve each query independently.
When solving a query, which elements of nums should you choose to make the subsequence as long as possible?
Choose the smallest elements in nums that add up to a sum less than the query.