Ration Shop Consecutive Allocation Feasibility
Ration Shop Consecutive Allocation Feasibility
A Mumbai ration shop has items distributed in N consecutive bins with varying quantities. Families request allocations from consecutive bins. Determine if all family requests can be satisfied without conflicts. Rule: process requests in order; request [s,e,amount] takes grain greedily from bins s..e (left to right) out of what REMAINS. Return 'true' if every request is fully satisfied, else 'false'. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.
Approach
Given an array of bin quantities and a list of family requests [start, end, amount_needed], determine if each family can be allocated their required quantity from their requested bin range.
Input
Output
More Arrays problems
Browse all coding problems →Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards