Debugging
- Stage
- 2
- Module
- M2.8
- Lessons
- 1
In this module
- Reproduce a bug on the smallest input that still shows it, before changing any code.
- Bisect a program by printing intermediate state and by using
assert, removing every print before submitting. - Recognize common bug families, including aliasing, mutating a list while iterating over it, integer versus float division, and a forgotten
.strip().
Before this module
Lessons
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2023 J3Special Event (opens on WMOJ in a new tab) WMOJ
Given each person's availability across five days, find the day or days when the most people can attend.
- 2020 J3Art (opens on DMOJ in a new tab) DMOJ
Given the coordinates of paint drops on a canvas, find the smallest rectangular frame that contains every drop without touching any of them.
Why DMOJ: An earlier, DMOJ-era problem, included here for extra practice.