Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Fix the cause, not the symptom

โญโญโญ advancedโณ 10 min read๐Ÿ“ Lesson 218 of 256

One token usually; re-run the WHOLE test set; say the one-sentence correction before typing.

Fix discipline. When you find the line, the fix is usually one token โ€” but three rules keep the fix honest:

  • Fix the cause, not the symptom. If the streak counter never resets, the bug is the missing else โ€” not a clamping if stapled at the end. Symptom fixes pass the given example and fail the hidden ones.
  • Re-run the WHOLE test set, not just the failing case. A fix that repairs case 3 and breaks case 1 traded one bug for another. The graded challenges here re-run everything.
  • Say the one-sentence correction: "the loop must run while i + k <= length, not i + k < length." If you cannot say the sentence, you have not found the bug โ€” you have found a symptom.

This module's broken solutions each hide exactly one bug; your fixed version must pass ALL tests including the boundary ones the original author forgot.

โšก Now practice

Ready to Code
Debug gauntlet: one bug eachFour broken methods with single subtle bugs; diagnose, name, fix.
4 challenges ยท ยท ~55 min