Imports, dependencies, and initialization

R-INIT-V4-3hard

Build the express table once

The checkout’s shipping-rate helper reads built-in rates and prints standard or express quotes in cents. It must use ready configuration without repeating derived-table setup for each quote. Inputs are a reduced, single-threaded process: all zone additions and overrides precede every quote, and configuration stays fixed after quoting begins. The supplied rates scale to whole cents; currency rounding is outside this startup probe. The build counter observes table construction calls; it measures no elapsed time.

What needs to change

Change how expressRate gets its table so express rates include added zones and the table is built at most once.

Reproduce

  1. Run the sample with go run: zone D is added, then an express quote in D and one in A. Compare every line, including the build count.

Acceptance criteria

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

Notes

scaleAll increments the package variable expressBuilds on each build. main applies every zone line to baseRates before it reads any quote line.

Sign in to open this exercise

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

Sign in