Skip to main content

Practice ยท 1 of 1

Inventory Operations

Implement add_stock(map, item, qty) (adds qty to item, inserting if needed) and stock_of(map, item) (returns qty, or 0 if absent โ€” WITHOUT using operator[] on the read path).

Difficulty: beginner

Back to lesson: Practice: Map & Set Practice: Lookups