Skip to main content

Practice ยท 4 of 4

Stock adjustments

CHALLENGE
Difficulty: beginner+25 XP

Implement static Dictionary<string, int> ApplySales(Dictionary<string, int> stock, IEnumerable<(string Sku, int Qty)> sales) โ€” subtract each sale's quantity from the matching SKU; a sale for an unknown SKU or one that would push stock negative must throw InvalidOperationException. Return the same dictionary instance, mutated.

Back to lesson: Practice: Collection workout