The Shape of a Good Solution

Under a clock, most candidates start typing about ninety seconds after the problem loads. That is the single most expensive habit in the format, because the cost of a wrong approach is not the time you spent writing it, it is the time you spend defending it once it half works.

What follows is an order of operations. It is deliberately mechanical, because the point is that it survives adrenaline.

1. Constraints, then statement

Read the bound on the input size and the time limit before the story. As the previous lesson showed, the bound usually names the complexity class, and the complexity class narrows the technique to two or three candidates. You are reading the statement with a hypothesis instead of building one from scratch.

2. Work the smallest interesting example by hand

The rest of this lesson is for subscribers

Unlock every lesson in Programming for Quantitative Developers, and every other premium course.

Subscribe to continue

Test your knowledge

Questions are only available to subscribers.

Keep reading Programming for Quantitative Developers

25 lessons in this course, and every other premium course, on one subscription.

  • Every lesson in every course, with the worked examples and interactive simulators
  • Graded questions on every lesson, with explanations for the wrong answers as well as the right one
  • The trainers, timed assessments and brainteaser library that go with them