New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Uber
Coding Question
AI Insights
Quick Summary
Determine the maximum number of consecutive items purchasable from a given starting index within a fixed budget.
Prioritize cheaper items first due to the non-decreasing price constraint.
Process multiple independent queries efficiently on a static input array.
What This Tests
Prefix sum optimization for constant-time range cost evaluation
Binary search application on cumulative arrays
Greedy strategy justification under monotonic constraints
Efficient batch query processing
Common Patterns
Prefix Sum
Binary Search
Greedy
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected