Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Diagnose before you read the fix

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

Compile or runtime? Always wrong or boundary-wrong? Construct the minimal failing input.

Diagnose before you read the fix. Every challenge in this lab shows a snippet and its symptom โ€” output, exception, or wrong count. Your submission must (1) predict/verify the symptom by reasoning, and (2) repair the snippet. The grader runs your REPAIRED version against tests that include the symptom case plus the edge cases the author forgot.

The diagnostic questions, in order:

  • Compile or runtime? An exception pinpoints the class instantly (ArrayIndexOutOfBounds โ†’ class 1 or 6; StackOverflow โ†’ class 12).
  • Always wrong or boundary-wrong? Always-wrong smells like an inverted condition or wrong operator; boundary-wrong smells like an index or a missing reset.
  • Wrong on which input? Construct the minimal input that shows the bug โ€” the answer usually falls out of tracing it.

Two snippets in this lab are actually correct โ€” diagnosing them as "no bug, tests pass" is the right answer. Calibration matters: not every weird-looking line is a bug.