Skip to main content

Code Katas

Attempt these four tasks before opening feedback. Keep a short contract, plan, argument or trace, and a looking-back note. These are the required P tasks; additional lesson drills are targeted repair or optional enrichment.

P13: Implement a boundary​

Implement lower_bound and compare it against a linear-scan oracle over small sorted lists. Explain why the two implementations use different reasoning.

P14: Implement construction​

Implement min_coins with witness reconstruction. Compare optimal lengths with breadth-first reachable-sum enumeration; check each returned witness.

P15: Read before running​

Trace lesson 14 mystery on [0,0,0] without executing. State the observed contract and repair it if the first non-negative index is required.

P16: Reduce a failure​

For a function returning sum(values[:-1]), define a failure predicate against sum(values). Shrink [0,7,0,2] and report the reduction relation and minimality limit.

Record assistance and reuse relevant lab evidence; do not duplicate the same work to satisfy several checklists.

If tracing remains unclear, use Dromey 1.4.4 (debugging programs) through the book index. Locate the exact local chunk in the reading guide; this link opens the index.