Skip to main content

Checkpoint: run compression

Challenge on lesson: Checkpoint: collapse the runs

CHALLENGE
Difficulty: intermediate+25 XP

Implement String compress(String s): collapse each run of equal adjacent characters to one copy ("aabbbca" โ†’ "abca"). Combine the run-boundary idea with the string accumulator; keep the first character unconditionally.

Back to lesson: Checkpoint: collapse the runs