Maximum Items Purchasable in a Suffix Under Budget
Given an array prices of n non-negative integers, where prices[i] is the price of item i, answer q queries.
Each query is [start, budget]:
- You may only purchase items whose indices sat...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
