⚠️ Blockly failed to load. Check your internet connection and refresh.
Shop Bargains
Problem
A shop has N items listed from cheapest to most expensive.

You have M euros to spend. You want to buy as many items as possible.

Greedy strategy: buy items in order from cheapest first. Stop when you can't afford the next item.

How many items can you buy?
Input Variables (pre-loaded)
💡 Drag N, M, and price of item i from Inputs.
Your Output
Result
Run your program to see the result.
Execution Log
Ready. Press ▶ Run to start.
Expected Answer
Answer:
?
Hint