Skip to main content

Practice · 1 of 1

Inventory Operations

CHALLENGE
Difficulty: beginner+25 XP

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).

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