Lessons 26–30 · About 60 min per lesson

Timed practice and review

Work independently through reading, testing, submission and review on three problems.

Lesson breakdown

  1. Lesson 26

    Survey three tasks and note constraints and likely approaches.

  2. Lesson 27

    Solve a simulation task and compare code with a hand trace.

  3. Lesson 28

    Solve an enumeration or counting task and check its worst-case cost.

  4. Lesson 29

    Use the specified I/O and log test or submission feedback.

  5. Lesson 30

    Select the trickiest task and review it with a counterexample and a fix.

Worked example

The pouring code ignores free space in the target. Find an input that exposes the bug.

How to solve it

Source 7 and target 6 at capacity 6 should return (7,6). Any transfer breaks the capacity rule.

Assignment

Try the three past problems linked below. Use Mixing Milk for simulation, Shell Game for enumeration and Making Mexes for frequency counts. Include a custom test for each.

Check your result

For each task, explain the state or candidate range, share code or where you got stuck, and include a complexity estimate.