Prompt
Implement a shopping cart function that takes current cart state and a product with quantity (positive to add, negative to remove). Return a NEW cart state without mutating the input. If quantity reaches 0 or below, remove the product. Removing a product not in the cart returns the cart unchanged.
Hints
Solution
Your Code
10 min