Sample cases sit between prose and hidden evaluation. Contestants often inspect them before finishing the statement, authors use them to test whether an explanation is coherent, and reviewers use them to compare their interpretation. That makes samples an interface, not decoration.
Their primary job is to expose the model. They are not a small substitute for a complete test set.
Give each sample one reason to exist
One sample may establish the ordinary flow of state. Another may clarify whether an interval endpoint is included. A third may show that two operations interact. If two samples teach the same fact, replace one with a case that resolves a different plausible interpretation.
A short note can name the decisive transition without narrating every arithmetic step.
Choose ambiguity before difficulty
Consider a synthetic sequence problem in which an operation affects all positions from an index onward. A large sample with many operations may look impressive while hiding the boundary convention. A three-element sequence with one operation at the first position and one at the last can make the convention unmistakable.
The best explanatory sample is often small enough to simulate by hand.
Separate valid extremes from invalid input
If zero, emptiness, equality, or a maximum value is permitted, a sample can demonstrate what that valid extreme means. If a case is forbidden by the constraints, do not use a sample to explain how it would behave. The statement should define the domain before examples illustrate it.
Do not encode the solution path
A sample explanation should clarify the required result, not reveal the intended algorithm accidentally. Describe the state change or why the output satisfies the definition. Avoid a walkthrough whose vocabulary points directly to a data structure when the problem is meant to require that discovery.
Review samples against wrong models
List the most plausible misreadings of the statement. Does at least one sample separate each serious misreading from the intended model? If two interpretations produce the same output on every sample, the examples are not doing enough specification work.
Then let validators and hidden cases test correctness across the full domain. Samples should make the question precise; they should not encourage confidence from matching three outputs.
A good sample gives the reader a smaller world in which the rules are visible. Once that world is understood, the full problem can begin.