Largest note first can fail
transcript
A cash machine must pay six with the fewest notes. Take the largest note first. It feels safe. Is it safe? Not always.
The notes are worth one, three and four. Largest first takes four, then one, then one. That is three notes in all. But three plus three needs only two notes.
The proof needs each value to divide the next. Three does not divide four. So the safe swap is gone, and the rule breaks.
Break the property on purpose. Run a brute force beside the rule. Stop at the first difference.
With divisible values, all one thousand inputs agree. Break the divisibility, and seed twenty-three fails. The failing input is tiny, so tracing it is quick.
Name the property the rule needs. Test the rule where that property fails. Only then submit your code.
Prove the rule before you code. Then test it against brute force. Full breakdown in the lecture.