You know the language now. What the papers really test is the next step: what do you do with a question you have never seen?
Picture the written paper of a bank's Assistant Programmer exam. Question 4 says: Write a program to find the second largest number in an array. You didn't practise this exact one. A student who has memorised twenty programs freezes when the twenty-first turns up. A student who has learned how to attack a problem takes one calm minute, writes the plain, slow way first, and then makes it faster. The second student scores more and, what matters more, knows what the program is doing.
This chapter teaches that way of working, on the problems the papers set again and again. It is the first of a run of lessons on coding problems. This one is about the method itself, about measuring speed, and about the patterns that find things; the next one takes swapping, sorting and the names of the big strategies; after that come the digit and divisor loops, patterns and strings, and the remaining everyday patterns.
By the end you'll be able to name the pattern behind a problem from its wording and walk it through five steps to a working answer. You'll measure how fast a program grows with Big-O and tell, from the size of the input, which methods are even possible. You'll write by hand the programs that written papers ask for year after year: the largest, smallest and second largest of some numbers, linear search and binary search, each with its complexity. You'll go further with binary search: the first place of a repeated value, how many copies there are, and the smallest answer that satisfies a test. And you'll know the answers to the MCQs that ask how many comparisons a search needs.