Lessons 1–5 · About 60 min per lesson
Statements, constraints and state
Extract inputs, outputs and the quantities that change at each step.
Lesson breakdown
- Lesson 1
Identify input and output lines and indexing rules.
- Lesson 2
Mark initial conditions, operations and the final objective.
- Lesson 3
Model the current situation with the smallest useful state.
- Lesson 4
Trace the official sample and check each state change.
- Lesson 5
Use constraints to construct minimum, equality and extreme cases.
Worked example
A scoreboard starts at 0, then adds 4, subtracts 1 and adds 3. Report the highest score reached.
How to solve it
Current scores are 0, 4, 3 and 6; running highs are 0, 4, 4 and 6. Print 6, keeping both current score and best so far.
Assignment
Implement the scoreboard maximum, counting the initial 0, and submit a trace table.
Check your result
Changes [+5,-8] → 5; [-2,-3] → 0; no operations → 0.