Go’s one loop and range

F-RANGE-V4-3hard

Keep original-item handles

A Go inventory editor reports current stock, applies a supplied bulk correction and returns original-record handles for its detail panel.

What needs to change

Repair selectItems so the returned handles satisfy the supplied original-item contract.

Reproduce

  1. Run main.go with the supplied input and compare original and selected counts with the expected reports.

Acceptance criteria

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

Notes

Keep original-item handles uses the complete Go file main.go, including its supplied input decoder, helpers and entry point.

Input is item count, bonus, then Count/Selected pairs. The caller selects handles, adds 10 to the first original item if present, then adds 1 through each returned handle. It prints original counts and selected counts; the source items slice is not resized while these handles are used.

Sign in to open this exercise

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

Sign in