Solving an Unseen Problem
Solving an unseen problem: a fixed sequence of steps from clarifying the input to tracing the code, so a coding problem never starts from a blank page.
Solving an unseen problem is a sequence of six steps taken in the same order every time: clarify the input, the output and the limits; work two examples by hand; state the brute force and its cost; find the bottleneck and choose a faster approach; write the code; and trace the examples through it. It matters because the mistakes that sink a solution, a misread problem, an approach too slow for the input, a starting value nobody chose, are made before the first line of code, and the sequence catches each one at the step where it is cheapest. The topic names the six steps and applies them to finding a ticket scanned twice at a gate, where the input limits rule out checking every pair. It traces the finished code on the hand-worked examples and the edge cases, carries the steps to the smallest gap between readings and to a playlist small enough that the brute force is the answer, shows the maximum that starts at 0 when the clarify step is skipped, and ends with an exercise on counting deliveries before a given time.
Contents
8 cardsnot started