Skip to main content

Practice · 4 of 5

Fix the run counter

CHALLENGE
Difficulty: intermediate+25 XP

runs returns 3 for "aabbbca" but the contract says 4. Trace the loop with a state table (i, charAt(i), count) and find the seeding error — the precondition allows the fix.

Back to lesson: Practice: String lab