References, pointers, and handles

F-REF-V4-2medium

Find a tub by its contents

Repair the stock-record editor: apply deliveries to the retained records, locate an exact requested name-and-quantity value, then maintain durable IDs across removal, sale and insertion.

What needs to change

Repair positionOf so a request finds the tub with the same contents.

Reproduce

  1. Pipe the sample requests into go run main.go and compare each request line.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its imports, readLines, the Tub type and main, which keeps the stall as []*Tub.

Input: up to 100 "name kg" requests with a single-word name and whole kg from 0 to 100. Stock holds green 5, black 2 and kalamata 4. Lookups must leave records unchanged; the supplied reader receives valid data.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in