At a superstore on GEC Circle in Chattogram, a cashier called Nasrin has four small jobs that never stop. Every 3rd customer gets a raffle token, every 5th gets a coupon, and the 15th gets both, so she has learned to ask "is this the 15th?" before she asks "is this the 3rd?". Her ledger has a running-total column, so when the manager asks for the sales from Tuesday to Thursday she subtracts one number from another and never adds up a column of figures. When a customer disputes exactly 700 taka, she hunts for two invoices that add up to it, and at each invoice she asks herself one question: "is the rest already on my list?". She keeps a tick register, so an invoice number used twice is caught the moment it turns up. And at the end of the month, the table of quantities times the table of prices gives each branch its total.
Nobody told Nasrin she was programming, yet those four jobs are four favourites of the written papers: FizzBuzz, prefix sums, hashing and matrices. You already own the loops that power all of them. The last chapter pointed those loops at pictures and at the letters of a string. This chapter points them at four more jobs, and each job comes with one idea that turns a slow answer into a fast one, or a wrong answer into a right one.