Skip to main content

Worked Examples

Three suggestions, one requirement​

Requirement: count every session at least 25 minutes, retaining duplicates. On [], [24,25,26], [25,25] and [1,240], the expected counts are 0, 2, 2 and 1.

The strict candidate uses >: it fails the equality-containing second and third cases, scoring 2/4. The unique candidate uses >= but deduplicates: it fails the repeated-duration case, scoring 3/4. The contract-matching candidate scores 4/4. These are authored fixtures, not measured outputs from any model.

Why the evaluator also needs checking​

An evaluator that always returns 4/4 would approve every candidate. A negative control with a deliberately wrong candidate checks the evaluation mechanism itself. Preserve the expected output before running the candidate; otherwise the “test” may merely agree with it.

A useful tutor exchange​

Learner: “I think equal durations were removed. Give me a distinguishing case, not a full rewrite.” Candidate hint: “Compare [25] with [26,26].” The first distinguishes an exclusive boundary; the second exposes deduplication. Verify those predictions yourself, then explain a repaired version without the hint.